GrooMeD-NMS: Grouped Mathematically Differentiable NMS for Monocular 3D Object Detection

Abhinav Kumar, Garrick Brazil, Xiaoming Liu

Abstract

Modern 3D object detectors have immensely benefited from the end-to-end learning idea. However, most of them use a post-processing algorithm called Non-Maximal Suppression (NMS) only during inference. While there were attempts to include NMS in the training pipeline for tasks such as 2D object detection, they have been less widely adopted due to a non-mathematical expression of the NMS. In this paper, we present and integrate GrooMeD-NMS -- a novel Grouped Mathematically Differentiable NMS for monocular 3D object detection, such that the network is trained end-to-end with a loss on the boxes after NMS. We first formulate NMS as a matrix operation and then group and mask the boxes in an unsupervised manner to obtain a simple closed-form expression of the NMS. GrooMeD-NMS addresses the mismatch between training and inference pipelines and, therefore, forces the network to select the best 3D box in a differentiable manner. As a result, GrooMeD-NMS achieves state-of-the-art monocular 3D object detection results on the KITTI benchmark dataset performing comparably to monocular video-based methods.

Introduction: The Training-Inference Mismatch

In the domain of object detection, models typically generate thousands of candidate bounding boxes for a single object. To refine these outputs, Non-Maximal Suppression (NMS) is employed as a standard post-processing step. NMS greedily selects the box with the highest confidence score and suppresses overlapping boxes with lower scores. However, traditional NMS is a discrete, non-mathematical algorithm, which prevents it from being integrated into the end-to-end training process.

This limitation leads to a "training-inference mismatch." During training, a network is optimized to assign high scores to any box that sufficiently overlaps with the ground truth. At inference, however, NMS might prioritize a box with high 2D confidence that has poor 3D localization (e.g., inaccurate depth), while suppressing a better-localized 3D box. This is particularly critical in monocular 3D detection, where depth estimation from a single image is notoriously difficult and 2D confidence does not always correlate with 3D accuracy.

Methodology: GrooMeD-NMS

The authors introduce GrooMeD-NMS (Grouped Mathematically Differentiable NMS) to bridge this gap by making the filtering process differentiable and integrating it directly into the training loop.

Matrix Formulation and Grouping

The core innovation lies in reformulating the iterative NMS process as a matrix operation. By approximating the rescoring process as a system of linear equations, the final scores $r$ can be expressed in a closed-form: $r \approx (I + P)^{-1}s$, where $s$ represents the initial scores and $P$ is a "Prune Matrix" based on box overlaps. To manage the computational complexity of matrix inversion, the authors employ unsupervised grouping. Boxes are clustered into small groups based on 2D overlap, and a binary mask is applied within these groups so that only the highest-scoring box suppresses others. This allows for a simple, parallelizable expression suitable for modern GPU acceleration.

Comparison of the conventional NMS pipeline (a) with the proposed GrooMeD-NMS pipeline (b), and a detailed view of the GrooMeD-NMS layer (c).

Differentiable Pruning and Loss

To allow gradients to flow back through the NMS layer, the authors replace the hard thresholding of classical NMS with soft, differentiable pruning functions. While they explored exponential and sigmoidal variants, a Linear pruning function was found to be the most effective and stable for training.

Visualization of various pruning functions $p(o)$ vs. IoU overlap $o$ used to approximate NMS.

Furthermore, the paper introduces an Imagewise AP-Loss. Standard classification losses often fail after NMS due to the extreme sparsity of positive samples (as NMS removes most candidates). This specialized loss focuses on the ranking of the few boxes that survive the GrooMeD-NMS layer, ensuring the network learns to prioritize the most accurate 3D detections.

Key Results and Insights

The proposed method was evaluated on the KITTI Object Detection Benchmark, the gold standard for autonomous driving research. GrooMeD-NMS achieved state-of-the-art performance for monocular 3D detection at the time of publication, even rivaling sophisticated video-based methods like Kinematic-3D.

Key findings include:

  • Improved Correlation: GrooMeD-NMS significantly improves the correlation between a box's confidence score and its actual 3D localization accuracy (increasing from $0.316$ in baselines to $0.345$).
  • Robustness in Challenging Scenarios: The method showed marked improvements in the "Moderate" and "Hard" KITTI categories, which feature distant or partially occluded objects.
  • Inference Flexibility: Since GrooMeD-NMS is a differentiable approximation of standard NMS, models trained with it can still use classical NMS during inference for speed without a performance penalty.

Conclusion

GrooMeD-NMS successfully integrates the NMS process into the training loop, resolving the long-standing mismatch between training objectives and inference behavior. By forcing the network to optimize for the boxes that actually survive post-processing, it achieves superior 3D localization. Future work may extend this differentiable framework to other domains, such as LiDAR-based detection or dense pedestrian detection in crowded scenes, where traditional NMS often struggles.

Summary updated

Abstract

Modern 3D object detectors have immensely benefited from the end-to-end learning idea. However, most of them use a post-processing algorithm called Non-Maximal Suppression (NMS) only during inference. While there were attempts to include NMS in the training pipeline for tasks such as 2D object detection, they have been less widely adopted due to a non-mathematical expression of the NMS. In this paper, we present and integrate GrooMeD-NMS -- a novel Grouped Mathematically Differentiable NMS for monocular 3D object detection, such that the network is trained end-to-end with a loss on the boxes after NMS. We first formulate NMS as a matrix operation and then group and mask the boxes in an unsupervised manner to obtain a simple closed-form expression of the NMS. GrooMeD-NMS addresses the mismatch between training and inference pipelines and, therefore, forces the network to select the best 3D box in a differentiable manner. As a result, GrooMeD-NMS achieves state-of-the-art monocular 3D object detection results on the KITTI benchmark dataset performing comparably to monocular video-based methods. Code and models at https://github.com/abhi1kumar/groomed_nms
BibTeX
@inproceedings{kumar2021groomed,
  author = {Abhinav Kumar and Garrick Brazil and Xiaoming Liu},
  title = {{GrooMeD-NMS: Grouped Mathematically Differentiable NMS for Monocular 3D Object Detection}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  url = {https://openreview.net/forum?id=Pgjqn8IP0rx},
}
Figure