Object detection, and the race to do it in real time
Scoring one detection: is the box good enough?
Why the result mattered
Video runs at 25–30 frames per second. A detector that needs seconds per frame can only work offline; one that needs 22 ms can steer a robot, count cars at a junction or follow a ball. YOLO showed that detection can be framed as one regression problem solved by one network, and that idea now runs on phones and drones.
Walk an image through YOLOv1
Worked example: YOLOv1 shapes, step by step
Same formula every time: O = ⌊(N − K + 2P) ÷ S⌋ + 1. Practise it in section 05.
Three ideas that make one look enough
Idea 1 · Grid responsibility
Click the image to move the selected object's centre.
Idea 2 · Confidence × class
Idea 3 · Non-maximum suppression
The YOLO rule: S × S × (B · 5 + C), in one pass
Why it is fast. Two-stage detectors first guess where objects might be, then classify each guess. YOLO regresses boxes and classes together from the whole image, so it also sees context: it makes fewer background mistakes than Fast R-CNN, which only sees each crop.
Shapes by hand and by eye
Worked example by hand: a 4 × 4 input and one 3 × 3 filter
Do it on paper
Multiply each input number under the window by the filter number on top of it, add the nine products, and write the sum in the output. Stride 1 moves the window one column; at the end of a row it drops one row. This filter (+1 left, −1 right) responds to vertical edges where the right side is brighter or darker than the left.
Where the weights live
The arithmetic for that layer appears here.
Weights
Compute (MACs)
Worked example: counting YOLOv1's weights
The Darknet release of YOLOv1 used a locally connected layer before fc1; this page follows the plain dense head described in the paper's figure, so treat the total as the dense-head version.
The YOLO family and its variants
| model | year | backbone / depth | output | weights | score | speed |
|---|
Click a row of the table.
Same idea, new parts. v2 added batch normalisation and anchors; v3 predicted at three scales with a feature pyramid; v4 collected training tricks; v8 dropped anchors. All still output a dense grid of boxes in a single pass.
The cost of one look
Reuse YOLO instead of retraining it
Which recipe?
What changes, what stays
Only the last layer's size depends on C. The labels change too: every training image needs boxes (x, y, w, h) and a class, not just one label per image. Keep the paper's augmentation (random scaling and shifts up to 20 %, exposure and saturation up to 1.5 ×) and report mAP at IoU 0.5 on a held-out set that looks like deployment.