forked from rohitg00/ai-engineering-from-scratch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquiz.json
More file actions
39 lines (39 loc) · 3.88 KB
/
Copy pathquiz.json
File metadata and controls
39 lines (39 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
"questions": [
{
"stage": "pre",
"question": "A YOLO detector with grid 13x13, 3 anchors per cell, and 20 classes produces a head output of shape (N, 13, 13, 3, 25). Why is the last dimension 25?",
"options": ["4 box coords + 1 bias + 20 classes", "4 box coords + 1 objectness + 20 classes = 5 + C", "25 is the number of classes in COCO", "It is padding to the next power of 2"],
"correct": 1,
"explanation": "Every anchor emits four box regression targets (tx, ty, tw, th), one objectness score, and C class logits. For YOLO-style detectors the per-anchor dimension is always 5 + C. On COCO with 80 classes it is 85; on PASCAL VOC with 20 it is 25."
},
{
"stage": "pre",
"question": "Why does YOLO predict tx, ty through a sigmoid before adding the grid cell?",
"options": ["To normalise them to [0, 1] so the centre stays inside the cell and cannot escape to a neighbouring cell's territory", "Sigmoid is required by the convolution", "To prevent NaN during training", "To make the box larger"],
"correct": 0,
"explanation": "sigmoid(tx) is in [0, 1], so (sigmoid(tx) + cell_x) * stride places the centre somewhere inside the cell at column cell_x. This constraint keeps each cell responsible for only the objects centred within its own area, which is the assumption that makes grid-based training stable."
},
{
"stage": "post",
"question": "Your detector predicts 15 boxes around a single object after the head. You apply NMS with iou_threshold=0.45 and get back 1 box. What did NMS do?",
"options": ["It averaged all 15 predictions", "It sorted the 15 boxes by score, kept the highest-scoring, and deleted every box whose IoU with it exceeded 0.45; the other 14 all overlapped the winner above the threshold so one remained", "It picked a random survivor", "It merged the boxes geometrically"],
"correct": 1,
"explanation": "NMS is a greedy deduplication: sort by score, keep the top, remove everything close to it (IoU > threshold), repeat. It does not merge or average. That is why detection latency benchmarks include NMS time and why modern models like RT-DETR replace it with a learned alternative."
},
{
"stage": "post",
"question": "Your model has mAP@0.5 = 0.75 but mAP@0.5:0.95 = 0.32. What is the most accurate interpretation?",
"options": ["The model is broken; mAP@0.5 must equal mAP@0.5:0.95", "The model finds the right objects but its boxes are not tightly localised — fine at IoU 0.5, fail at IoU 0.7+", "The dataset has too many classes", "The inference threshold is too high"],
"correct": 1,
"explanation": "mAP@0.5 is lenient about localisation; mAP@0.5:0.95 averages over strict thresholds up to 0.95. A big gap between the two means the boxes are in roughly the right place but not tight. Typical fixes: CIoU/DIoU box loss, higher-resolution features, anchor sets better tuned to the dataset."
},
{
"stage": "post",
"question": "YOLO loss weights lambda_coord=5.0 and lambda_noobj=0.5 roughly mirror the original paper. What do these ratios encode?",
"options": ["GPU memory trade-offs", "The fact that most cells have no object, so the no-object cells must be downweighted or they would dominate the total loss; and the fact that box regression is a smaller-scale loss than cross-entropy, so it needs upweighting to produce comparable gradients", "Random choices the authors never justified", "The number of anchors per cell"],
"correct": 1,
"explanation": "In a 13x13 grid there are 169 cells, usually with one to five objects. The 160+ empty cells all contribute objectness loss; without a small lambda_noobj they would overwhelm the positive signal. Conversely, MSE box loss is numerically small next to cross-entropy, so lambda_coord > 1 keeps its gradients comparable. Both ratios are about balancing per-component gradient magnitudes."
}
]
}