Quiz: detecting objects in one pass
Before this unit: Flow fields to objects (previous unit); Day 41: Modern deep learning; Day 38: Evaluation and statistics.
See also: Day 15: Watershed; Day 10: Edge-preserving smoothing and PDEs; Day 27: Graph cuts.
Short questions to test your understanding. Try each on paper first, then open the answer.
Q1. What does one output cell of a single-shot detector predict?
Where are the sides, and what is it?
Four distances from the cell centre to the left, top, right and bottom side of a box (each as a distribution over 0–15 strides; the distance is its mean) and one probability per class. Together with the cell’s position this is one candidate box per class.
Q2. The network’s output has a fixed size. How can it report 3 objects in one image and 300 in another?
How many guesses, and what are most of them?
Every cell of the grids (5376 for a 512 × 512 input) makes one guess, and most guesses are “nothing” (all class probabilities low). The score threshold keeps the confident guesses and NMS removes duplicates: the remaining list is as long as the image needs, up to the number of cells.
Q3. A side’s distribution puts 0.25 on each of the bins 2, 3, 4 and 5. What distance is decoded, in pixels at stride 16? And with 0.5 on 1 and 0.5 on 11?
The distance is the mean of the bins.
Mean 0.25(2 + 3 + 4 + 5) = 3.5 strides = 56 px. The second: mean 6 strides = 96 px, where neither guess is: a very uncertain edge.
Q4. Why does the detector use three grids (strides 8, 16 and 32) rather than one?
Reach of a side, and the size of the smallest objects.
A side can be at most 15 strides from the cell centre: 120 px at stride 8, 480 px at stride 32. Large objects need coarse grids; small objects need fine grids, whose cell centres are close enough together to fall inside a small box (and two small neighbours get different cells). Each grid answers for its own size range.
Q5. A box scores 0.8 for “cell” and another, almost identical box 0.6 for “debris”. Which survives class-aware NMS, and which class-agnostic NMS?
Which boxes does each variant compare?
Class-aware NMS compares only boxes of the same class: both survive. Class-agnostic NMS compares all boxes: the debris box overlaps the better cell box and is removed.
Q6. Why can an object that matches no anchor never be detected by an anchor-based network?
Which anchors get the label “object” during training?
During training only anchors with IoU \ge 0.5 (or the best one) with an object are told “object” and learn its box correction. If no anchor overlaps the object enough, it is labelled background everywhere, and the network learns to ignore it.
Q7. How does a centre heat map find objects, and which earlier method uses the same step?
Peaks in a map.
Objects are the local maxima of the predicted map above a threshold (a pixel larger than all others in its window). The same peak picking finds lines and circles in the Hough accumulator.
Q8. A detector trained on everyday photos finds nothing on an image of fluorescent nuclei, even at a low threshold only “person” and “sports ball”. Why?
What can its class scores say?
It can only answer the classes it was trained on, and none of them is “cell” or “nucleus”; nuclei look like none of them, so every class probability stays low (the highest in our example was 0.045). It needs fine-tuning on images of cells with a box around every cell.
Q9. (math) Compute GIoU = \mathrm{IoU} - |C \setminus (A \cup B)|/|C| for A = [0, 2]^2 and B = [4, 6] \times [0, 2] (C is the smallest box enclosing both). Why is 1 - \mathrm{GIoU} a better training loss than 1 - \mathrm{IoU} here?
C = [0, 6] \times [0, 2].
IoU 0; |C| = 12, |A \cup B| = 8; GIoU = 0 - 4/12 = -1/3. 1 - \mathrm{IoU} is 1 for every position of disjoint boxes (no gradient), while 1 - \mathrm{GIoU} decreases as B moves towards A, so it pulls the predicted box towards the true one.