Practice
1. Given the following Python code snippet using a pre-trained YOLO model, what will be the output shape of the detection results?
import torch
from torchvision.models.detection import yolo_v3
model = yolo_v3(pretrained=True)
model.eval()
input_tensor = torch.rand(1, 3, 416, 416)
output = model(input_tensor)
print(output[0]['boxes'].shape)easy
Solution
Step 1: Understand YOLO output
YOLO outputs a list of detections, each with a bounding box of 4 coordinates.Step 2: Determine output shape
The shape is (N, 4) where N is the number of detected objects.Final Answer:
Option B -> Option BQuick Check:
YOLO boxes = (N, 4) [OK]
Hint: YOLO boxes = (N, 4) [OK]
Common Mistakes:
2. In the context of data labeling strategies, which method is best suited for generating large amounts of labeled data quickly but with potentially lower accuracy?
easy
Solution
Step 1: Understand the methods.
Human annotation is accurate but slow. Weak supervision uses heuristics or external data sources to generate labels quickly but may be less accurate.Step 2: Eliminate wrong options.
Programmatic labeling is similar to weak supervision but often requires more setup. Active learning involves human input and is not as fast.Final Answer:
Option A -> Option AQuick Check:
Weak supervision = fast, less accurate [OK]
Hint: Weak supervision = fast, less accurate [OK]
Common Mistakes:
3. In the context of the No Free Lunch Theorem, which statement is true about model performance across different datasets?
easy
Solution
Step 1: Understand the No Free Lunch Theorem
The theorem states that no single model is universally best across all datasets.Step 2: Eliminate wrong options
A model that performs well on one dataset will perform well on all datasets. is incorrect because model performance varies by dataset. The best model for a dataset can be determined without testing. is incorrect because testing is necessary to determine the best model. A complex model always outperforms a simple model. is incorrect because complexity does not guarantee better performance.Final Answer:
Option B -> Option BQuick Check:
No universal best model. [OK]
Hint: No universal best model. [OK]
Common Mistakes:
4. When choosing between LSTM and GRU for a time series prediction task with limited computational resources, which is generally more appropriate and why?
medium
Solution
Step 1: Compare LSTM and GRU.
GRU is simpler and often faster due to fewer parameters, making it suitable for limited resources.Step 2: Eliminate wrong options.
LSTM's complexity isn't always needed, GRU isn't always more accurate, and LSTM's longer sequence handling isn't a universal advantage.Final Answer:
Option C -> Option CQuick Check:
GRU: fewer parameters, faster. [OK]
Hint: GRU: fewer parameters, faster. [OK]
Common Mistakes:
5. You are tasked with improving a model's performance on a highly imbalanced dataset. Which approach is most appropriate to prevent overfitting while addressing class imbalance?
hard
Solution
Step 1: Address class imbalance and overfitting
Class weights help balance the dataset, and early stopping prevents overfitting by halting training when validation performance stops improving.Step 2: Eliminate wrong options
Use SMOTE to oversample the minority class and increase model complexity. increases complexity, risking overfitting, Downsample the majority class and increase the learning rate. may lead to instability, and Use a simpler model with no regularization. lacks regularization, increasing overfitting risk.Final Answer:
Option C -> Option CQuick Check:
Class weights + early stopping = balanced, robust model [OK]
Hint: Class weights + early stopping = balanced, robust model [OK]
Common Mistakes:
