Soft-NMS - Improving Object Detection with One Line of Code

Navaneeth Bodla, Bharat Singh, Rama Chellappa, Larry S. Davis

Introduction: The NMS Bottleneck

In modern object detection pipelines, algorithms generate a vast number of candidate bounding boxes. To refine these into a final set of detections, a post-processing step known as Non-Maximum Suppression (NMS) is employed. Traditional "Greedy NMS" operates on a simple principle: it selects the box with the highest confidence score and discards all other nearby boxes that overlap with it beyond a predefined threshold (typically 50% IoU).

While effective at reducing false positives, this "hard" pruning creates a significant issue in crowded scenes. When two objects of the same class are physically close—such as people in a crowd or horses in a herd—their bounding boxes naturally overlap. Standard NMS often deletes the detection for the second object because it is too close to the first, leading to missed detections and reduced accuracy.

The Soft-NMS Algorithm

To address this, the authors propose Soft-NMS. Instead of completely removing overlapping boxes, Soft-NMS applies a decay function to their confidence scores. The core idea is that a high overlap with a top-scoring box should decrease our confidence that a second box represents a new object, but it shouldn't necessarily eliminate it.

Algorithm pseudocode comparing NMS and Soft-NMS.

The paper introduces two primary decay methods:

  1. Linear Decay: The score is reduced linearly based on the Intersection over Union (IoU).
  2. Gaussian Decay: A continuous penalty function based on a Gaussian distribution, which offers greater robustness by avoiding hard thresholds.

Because Soft-NMS only modifies scores rather than deleting boxes, it preserves the possibility of detecting partially occluded objects. Furthermore, it maintains the same $O(N^2)$ computational complexity as traditional NMS, making it a seamless "one-line" replacement in existing codebases.

Key Insights and Intuition

The fundamental shift in Soft-NMS is moving from binary "keep or kill" logic to a probabilistic "certainty decay." By retaining boxes with reduced scores, the algorithm allows occluded objects to remain in the final ranked list.

Visualizing the Soft-NMS intuition in crowded scenes.

This approach is particularly beneficial in categories where objects cluster naturally. While the performance gain for isolated objects (e.g., a single toaster) is negligible, the improvements are substantial for "crowd" categories like people or livestock. Additionally, Soft-NMS (especially the Gaussian variant) proves to be more stable across different hyper-parameter settings compared to the highly sensitive thresholding of traditional NMS.

Experimental Results

The authors validated Soft-NMS across major benchmarks, including PASCAL VOC 2007 and MS-COCO, using state-of-the-art detectors like Faster R-CNN and R-FCN.

  • MS-COCO: Soft-NMS delivered a 1.3% mAP boost for R-FCN and a 1.1% boost for Faster R-CNN.
  • PASCAL VOC: Both architectures saw a 1.7% improvement in mAP.
  • State-of-the-Art Integration: Applying Soft-NMS to a Deformable-RFCN model increased its MS-COCO performance from 39.8% to 40.9% without any retraining.

Conclusion

Soft-NMS represents a rare "win-win" in deep learning: a simple, computationally efficient modification that consistently improves performance across diverse models and datasets. By replacing hard suppression with a more nuanced score decay, it effectively handles the challenges of object detection in crowded and occluded environments. As a post-processing step requiring zero retraining, it serves as an immediate performance upgrade for any modern detection pipeline.

Summary updated

BibTeX
@inproceedings{bodla2017soft,
  author = {Navaneeth Bodla and Bharat Singh and Rama Chellappa and Larry S. Davis},
  title = {{Soft-NMS - Improving Object Detection with One Line of Code}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2017},
  doi = {10.1109/iccv.2017.593},
}
Figure