YOLO, one look at a grid


Grid
Keep scores above
NMS: suppress if IoU >
1. Look once
2. Clean up (NMS)
Show
Click any cell to see the numbers it predicts. A dot marks each animal’s center; the cell it falls in is shaded. Dashed boxes, once NMS is done, mark where the real animals are.

What one cell predicts

 

The whole idea.
The object-detection page slides a window over the picture and checks thousands of positions one by one. YOLO — You Only Look Once — does not slide anything. It lays a grid over the picture, and one pass of a CNN gives an answer for every cell at the same time. Each cell answers the same short list of numbers: where the box is (x, y, w, h), how sure it is that the box holds an object (the confidence), and which class it is (one probability per class). The whole answer is one block of numbers, grid × grid × numbers per cell, so the network is fast enough for live video. The grid does not cut the picture into small pictures: the CNN looks at the whole picture once, and each cell is just one slot in its answer. That is why a cell can draw a box much bigger than itself.

Which cell answers?
The cell that holds the center of an animal is the one responsible for it. Neighbor cells that only overlap part of the animal also guess a box, but each cell’s box must be centered inside that cell, so their guesses sit off to one side and score lower. The score of a box is its confidence times its class probability. That still leaves a few duplicates around each animal, so YOLO ends with the same two clean-up steps as the other pages: drop the low scores, then NMS.

What is simulated here.
A real YOLO learns its numbers from thousands of labeled photos. This page has no trained network, so each cell’s numbers are made the way a trained one behaves: the box is the real box plus a small, fixed error, moved inside the cell if needed; the confidence is the share of the cell the animal covers (1 for the responsible cell) times the IoU of the cell’s box with the real one; and the class probabilities are the share of the cell covered by cats and by dogs. On this page each cell gives one box; the first YOLO gave two per cell, newer ones give more.

Things worth trying:
1. Press Predict every cell at once. On the 7 × 7 grid (the size the first YOLO used), 35 of the 49 cells overlap an animal, and 8 boxes score 0.30 or more. Then Run NMS to the end: 8 boxes become 5, and all 5 animals are found.

2. Switch to 3 × 3 or 5 × 5. The centers of the two small cats now fall in the same cell, and a cell gives only one box, so one cat is never found: 4 of 5. This is the classic weak spot of the first YOLO — small objects close together. Newer versions use finer grids and several boxes per cell.

3. On 7 × 7, pull the score cut-off down to 0.05. Now cells that barely touch an animal get boxes too: 22 boxes, and NMS leaves 13 — the 5 animals plus 8 false alarms. At 0.20 the false alarms are gone.

4. Try 9 × 9. The big dog now spans many cells, and two of its neighbors guess boxes that overlap the best dog box by 0.45 and 0.48 — just under the NMS limit of 0.50, so both survive as false alarms. Slide the NMS limit to 0.40 and they are suppressed: 5 boxes, 5 animals.