The problem it solves
A detector predicts a box at many positions, so one object produces a cluster of overlapping boxes rather than a single answer.
- : a predicted box.
- : its confidence score.
Non-maximum suppression keeps the most confident box in each cluster and deletes the rest, using overlap as the definition of a cluster.
The algorithm, in order
- Discard every box scoring below a confidence floor.
- Sort what is left by score, highest first.
- Take the top box and move it to the output.
- Delete every remaining box whose IoU with it exceeds .
- Repeat from step three until nothing remains.
It runs per class, not across classes, because a person standing in front of a car should produce both boxes rather than the more confident one.
The cost is quadratic in the number of surviving boxes, which is why the confidence floor in step one matters as much for speed as for precision.
The threshold is a direct trade
Low suppresses aggressively, which removes duplicates and also removes genuinely distinct objects that happen to overlap.
High keeps more, which preserves crowded scenes and leaves duplicate boxes on single objects.
A crowd of people is the case that breaks it. Two pedestrians standing together can overlap at 0.6, so any threshold below that erases one of them and that error is unrecoverable.
Soft suppression
Soft-NMS decays a neighbour's score in proportion to its overlap instead of deleting it outright.
A box overlapping at 0.9 is almost erased. A box overlapping at 0.55 is reduced but survives to be judged on its own merit.
That single change recovers most of the crowded-scene loss and costs one line, which is why it is the usual first fix when recall is low in dense images.
Why detectors are now built to avoid it
NMS is not differentiable, so it sits outside the model as a fixed post-processing rule that no gradient ever reaches.
It also has to run before any output can be returned, and its quadratic cost is a real share of a real time detector's latency.
DETR and its successors remove it entirely by training with a bipartite matching loss, where each object may be claimed by exactly one prediction.
Duplicates are then penalised during training rather than deleted afterwards.
The model then emits one box per object directly, and the pipeline has one fewer threshold nobody can tune from data.