IoU and Non-Max Suppression
A detector never proposes just one box per object — it proposes dozens. IoU measures how much two boxes overlap; NMS uses that number to collapse the pile back down to one box per object.
NMS Threshold
boxes A-D are four raw proposals from one detector pass, four confidence scores, two actual objects
Confidence
Proposals
—Pairwise IoU
Result
IoU and Non-Max Suppression: A Practical Guide
Turning a pile of overlapping boxes into one box per object.
Quick Context
A detector's region proposal stage doesn't stop at one box per object — it scores hundreds of candidate boxes and keeps every one above a confidence floor, which for a single real object usually means a cluster of overlapping, near-duplicate boxes. Intersection over Union (IoU) is the standard way to measure how much two boxes overlap: the area they share, divided by the total area either one covers. IoU = 1 means identical boxes; IoU = 0 means no overlap at all.
Non-Max Suppression
NMS turns that overlap score into a cleanup rule. Sort every proposal by confidence, descending. Take the top one, keep it, and discard every remaining box whose IoU with it exceeds a threshold — those are treated as duplicate detections of the same object. Move to the next surviving box by confidence and repeat, until nothing is left to process. The threshold is the only knob: too low and boxes on genuinely different but nearby objects get merged into one; too high and duplicate boxes on the same object all survive.
Interactive Exploration Guide
- Read the stage at the default threshold. Box A (confidence 0.95) is kept. Box D, a separate object with no real overlap with A, is also kept. Boxes B and C overlap A too heavily and are suppressed as duplicates.
- Lower the threshold toward 0.1. Nothing changes here — B and C already fail a much looser bar, so tightening it further has no effect on this particular layout.
- Raise the threshold past roughly 0.59. Box B's overlap with A no longer exceeds the (now looser) suppression bar, so B is kept as a second detection of what is really the same object.
- Raise it past roughly 0.81. Now C survives too — at this threshold NMS considers all four boxes different enough to keep, even though A, B and C clearly describe one dog.
Key Takeaway
IoU is a pure geometry calculation — it knows nothing about confidence or class. NMS is the policy layer that uses it: keep the most confident box, discard anything that overlaps it past a threshold, repeat. Set the threshold too low and it merges distinct nearby objects into one detection; set it too high and duplicate boxes on the same object all survive. Every object detector that outputs boxes runs some form of this after its raw proposals come out.