Practice
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)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]
Solution
Step 1: Identify the constraint
Gradient Descent is more suitable for large datasets that don't fit in memory because it can process data in batches.Step 2: Eliminate wrong options
Least Squares is efficient for small datasets (A), interpretability is not a deciding factor (C), and noise handling depends on regularization, not the optimization method (D).Final Answer:
Option C -> Option CQuick Check:
Gradient Descent handles large datasets in batches. [OK]
Solution
Step 1: Understand the application of slice-based evaluation
Slice-based evaluation helps identify performance issues in specific data subsets.Step 2: Apply to multilingual context
Creating slices based on language allows for targeted performance analysis and improvements.Final Answer:
Option B -> Option BQuick Check:
Slice by language for targeted analysis. [OK]
Solution
Step 1: Consider real-time constraints
Stochastic Gradient Descent (SGD) updates weights after each data point, allowing for faster, more frequent updates suitable for real-time systems.Step 2: Eliminate wrong options
Batch Gradient Descent (A) is too slow for real-time, Least Squares (C) is not iterative, and Mini-batch (D) is a compromise but not as fast as SGD.Final Answer:
Option A -> Option AQuick Check:
SGD updates weights after each data point. [OK]
Solution
Step 1: Addressing class imbalance.
Applying class weights helps logistic regression focus more on the minority class by penalizing misclassifications more heavily.Step 2: Eliminate wrong options.
Use a higher learning rate to speed up convergence. is incorrect as learning rate affects convergence speed, not class balance. Increase the number of iterations to ensure convergence. is incorrect because more iterations don't address imbalance. Use a linear kernel to transform the feature space. is incorrect as logistic regression doesn't use kernels.Final Answer:
Option C -> Option CQuick Check:
Use class weights for imbalance [OK]
