Step by Step
P
The problem — hundreds of overlapping boxes per object
Object detectors typically predict hundreds of overlapping bounding boxes around each actual object, meaning without any cleanup step, a single car might end up with 50 separate overlapping predicted boxes around it.
Example: a raw detector output containing 50 separate, heavily overlapping bounding boxes all attempting to detect the same single car in an image.
S
Sort by confidence — highest first
Non-Maximum Suppression begins by sorting all predicted boxes by their confidence score, from highest to lowest.
Example: sorting all 50 overlapping car boxes by their confidence scores, identifying which single box the detector was most confident about.
K
Keep the highest, delete overlapping duplicates
NMS keeps the single highest-confidence box, then deletes any remaining boxes that have an IoU above a set threshold against that kept box, and repeats this process for the remaining boxes.
Example: keeping the single highest-confidence box among the 50 car candidates, then deleting all the other boxes that overlap substantially (high IoU) with that kept box.
R
Result — one clean box per object
After NMS completes, the result is one single, clean bounding box per actual object, rather than the original mess of dozens of overlapping duplicate predictions. NMS is a standard final step in YOLO, Faster R-CNN, and virtually every real-time object detector.
Example: the original 50 overlapping car-detection boxes being reduced down to just one single, clean, high-confidence box representing that one car, after NMS is applied.
Applied Walkthrough
1
An object detector processes an image and produces 50 separate, heavily overlapping bounding box predictions, all attempting to detect the same single parked car.
2
Without any cleanup step, the final output would show all 50 redundant, overlapping boxes cluttering the same car, rather than one clean detection.
3
Applying NMS, all 50 boxes are sorted by confidence score, the single highest-confidence box is kept, and all the other boxes overlapping substantially with it (high IoU against the kept box) are deleted.
4
This process repeats for any remaining objects in the image, ultimately producing exactly one clean bounding box per actual object — which is exactly why NMS is a standard, essential final step in virtually every real-time object detector, including YOLO and Faster R-CNN.
Exam Application
Exams test whether you understand why NMS is necessary (detectors naturally produce many overlapping redundant boxes per object) and whether you can correctly describe the NMS algorithm itself: sort by confidence, keep the highest, delete high-IoU overlapping duplicates, repeat.
⚠ Common Trap
The most common trap is assuming object detectors naturally output just one clean box per object without any additional cleanup step. In reality, detectors typically produce many overlapping redundant predictions per object by default, and NMS is a necessary, standard post-processing step required to clean this up into one final box per object.
✓ Quick Self-Check
1. What problem does NMS solve?
Object detectors typically predict hundreds of overlapping bounding boxes around each actual object, requiring cleanup into one clean box per object.
Tap to reveal / hide
2. What is the first step of the NMS algorithm?
Sorting all predicted boxes by their confidence score, from highest to lowest.
Tap to reveal / hide
3. After keeping the highest-confidence box, what does NMS do with the remaining boxes?
Deletes any remaining boxes with an IoU above a set threshold against the kept box, then repeats the process.
Tap to reveal / hide
4. What is the final result after applying NMS?
One clean bounding box per actual object, rather than many overlapping duplicate predictions.
Tap to reveal / hide
5. Name two real-time object detectors that use NMS as a standard final step.
YOLO and Faster R-CNN (or any other real-time detector).
Tap to reveal / hide