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. When designing a CNN for image classification, why might you choose to use a smaller receptive field in the initial layers?
medium
Solution
Step 1: Understand receptive fields
Smaller receptive fields in initial layers help capture fine-grained local features, which are crucial for understanding detailed patterns.Step 2: Eliminate wrong options
To capture more global features early on is incorrect because global features are captured in deeper layers. To reduce the computational cost of the network is incorrect as smaller receptive fields don't necessarily reduce computational cost. To increase the depth of the network without increasing parameters is incorrect because depth and parameters are not directly related to receptive field size.Final Answer:
Option C -> Option CQuick Check:
Smaller fields capture local details. [OK]
Hint: Smaller fields capture local details. [OK]
Common Mistakes:
3. When monitoring an ML model in production, which approach is better for detecting data drift and why?
medium
Solution
Step 1: Identify effective drift detection
Monitoring statistical properties helps detect subtle changes in input data.Step 2: Eliminate wrong options
Use a static threshold on model accuracy. is reactive, not proactive. Rely on user feedback to identify issues. is unreliable and subjective. Increase the frequency of model retraining. addresses performance decay, not drift detection.Final Answer:
Option A -> Option AQuick Check:
Monitor input stats for drift detection [OK]
Hint: Monitor input stats for drift detection [OK]
Common Mistakes:
4. You are tasked with deploying a calibrated model for a real-time fraud detection system. Which approach ensures both calibration and low latency?
hard
Solution
Step 1: Consider latency and calibration.
Real-time systems require low latency, favoring pre-trained models.Step 2: Evaluate each approach.
Batch processing (A) and online learning (B) introduce latency. Pre-trained models (C, D) are faster, but Platt Scaling (C) is more efficient than Isotonic Regression (D).Final Answer:
Option A -> Option AQuick Check:
Pre-trained + Platt = fast calibration. [OK]
Hint: Pre-trained + Platt = fast calibration. [OK]
Common Mistakes:
5. You need to track the lineage of a model from data ingestion to deployment using MLflow. Which approach best achieves this?
hard
Solution
Step 1: Understand MLflow's capabilities
MLflow alone does not track data lineage; integration is needed.Step 2: Evaluate options for lineage tracking
Integrating with a dedicated lineage tool provides comprehensive tracking.Final Answer:
Option B -> Option BQuick Check:
Lineage needs integration [OK]
Hint: Lineage needs integration [OK]
Common Mistakes:
