Recipe
Run the object detection pipeline end to end
Use when: you have a trained detector and a new image, and need a final, clean list of detected objects
Goal: a set of final detections, each with a class, a box, and a confidence score, cleaned of duplicates and thresholded to a usable confidence level
Taught in Precision, recall, and mAP
Quick recipe
-
1
Resize, normalize, and format the image the way the detector's own input pipeline expects (Chapter 12's own preprocessing conventions).
Why: a detector's backbone was trained on inputs in one specific format. Feeding it anything else produces meaningless output, not an error.
-
2
Pass the preprocessed image through the network: a backbone (Chapter 12) extracts features, and a detection head turns those features into raw candidate boxes with class scores.
Why: this is the network doing the actual "where might objects be" work. Everything after this step is bookkeeping on its output, not more learning.
-
3
Read off every candidate box the head produced, each with a class label and a confidence score (Section 1). For a one-stage detector, this is usually hundreds of boxes, most of them near-duplicates or noise.
Example
A detector reports 340 raw boxes for one image. Most are low-confidence noise or duplicates of the 5-6 real objects actually present.
Why: nothing has been filtered yet. This is the pipeline's rawest, most honest checkpoint, useful for debugging (Lab B).
-
4
Discard every box whose score falls below a chosen threshold (Section 4's own worked example: 0.5, 0.6, 0.9 all give different, valid results).
Why: a low-confidence box is the detector's own way of admitting it isn't sure. Keeping every one of them would flood the final result with noise.
-
5
Run NMS (Section 2) on the boxes that survived filtering, separately per class, to collapse duplicate detections of the same object down to one.
Why: without this step, one real object gets listed many times. That wrecks precision, even though every individual box might be "correct."
-
6
The boxes left after both filters are the pipeline's actual output. Report each one's class, box coordinates, and confidence score.
Why: this is the output everything upstream exists to produce: a clean list of detections, with duplicates removed and confidence high enough to trust.
Common mistakes
- Running NMS before the confidence filter, instead of after: this wastes the suppression step comparing boxes that a simple threshold would have removed for free.
- Running NMS across all classes at once instead of per class: this wrongly removes one of two genuinely different objects that happen to overlap (Section 2).
- Treating raw, not-yet-filtered detector output as "the result": this is Step 3's checkpoint, not the pipeline's actual output.
- Comparing two detectors' mAP scores from different datasets, or different IoU conventions, as if they were the same measurement.