Non-Maximum Suppression (NMS) is a post-processing algorithm used in object detection to eliminate redundant overlapping bounding box proposals by retaining only the highest-confidence detection and discarding lower-confidence boxes that exceed a predefined intersection-over-union (IoU) threshold. The procedure iteratively selects the detection with the highest class score, suppresses all remaining boxes that sufficiently overlap with it, and repeats until no candidates remain. NMS is a critical component of single-stage and two-stage detectors including YOLO, SSD, and Faster R-CNN families. Soft-NMS and class-agnostic variants address edge cases where multiple legitimate objects are densely packed.
Overview
- Most Computer Vision detection frameworks — YOLO, SSD, Faster R-CNN — rely on NMS as their final filtering stage.
- The algorithm prevents the same physical object from being reported multiple times by different candidate anchors.
- Computational cost is O(n²) in the number of proposals, making batched GPU implementations important for real-time inference.
Key aspects
- IoU threshold: the primary hyperparameter governing the aggressiveness of suppression; typical values range from 0.3 to 0.7.
- Class-agnostic NMS: suppresses across all classes simultaneously, reducing false multi-class duplicates.
- Soft-NMS: decays scores rather than zeroing them, improving recall in crowded scenes.
- DIoU-NMS: incorporates distance and aspect ratio in the overlap measure for better localisation.
Mechanisms
- Proposals from Bounding Box Regression are ranked by confidence score.
- The top-scoring box is selected; all remaining boxes with IoU above threshold are discarded.
- Process repeats on the remaining candidate set until exhausted.
Applications
- Pedestrian detection in autonomous driving perception stacks.
- Face detection for biometric identification pipelines.
- Medical imaging analysis where multiple overlapping region proposals arise from dense anatomical structures.
- Real-Time AI Inference serving for surveillance and retail analytics.