What is non-maximum suppression?
Non-maximum suppression is the cleanup step that turns a detector's raw, redundant output into clean detections. Object detectors typically predict many overlapping boxes around each object, and NMS resolves this by keeping the box with the highest confidence and discarding nearby boxes that overlap it beyond a threshold. The result is roughly one box per real object.
It runs after the model produces predictions and before the results are scored or used, so it directly shapes precision and recall.
Key takeaways
- NMS removes duplicate, overlapping detections of the same object.
- It keeps the highest-confidence box and suppresses heavy overlaps.
- It is a post-processing step, not part of the model's learned weights.
How it works
Predictions are sorted by confidence. The top box is selected, and any remaining box whose intersection over union with it exceeds a set threshold is removed as a duplicate. The process repeats on the remaining boxes until none are left. The overlap threshold is a tuning knob: too strict leaves duplicates, too loose can merge distinct nearby objects.
Why it matters
Without NMS, a detector's metrics and outputs would be flooded with redundant boxes, so it is essential to fair evaluation and usable results. Because it depends on confidence scores and intersection over union, NMS ties directly to how detection precision and recall are measured.
Frequently asked questions
Is NMS part of the neural network?
No. It is a post-processing step applied to the model's predictions, though some newer detectors aim to reduce or remove the need for it.
What threshold does NMS use?
It uses an intersection over union threshold to decide when two boxes overlap enough to be duplicates, and that threshold is tuned per application.
Related terms