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 modern object detection, models typically output thousands of candidate bounding boxes. To refine these predictions, Non-Maximal Suppression (NMS) is used during inference—a greedy algorithm that removes overlapping boxes, leaving only the one with the highest confidence score.
However, standard NMS is non-differentiable, meaning it is traditionally treated as a post-processing step used only during testing. During training, loss functions are typically applied to all predicted boxes. This creates a significant training-inference mismatch: the network is not explicitly trained to ensure that the box with the highest confidence score is also the one with the best 3D localization (depth, orientation, etc.). In monocular 3D detection, where depth estimation is inherently difficult, this mismatch often leads to "high-confidence" boxes that are physically misplaced.
Methodology: GrooMeD-NMS
To bridge this gap, the authors propose GrooMeD-NMS (Grouped Mathematically Differentiable NMS), which integrates the NMS process directly into the end-to-end training loop.
1. Matrix Formulation
The iterative NMS algorithm is reformulated into a closed-form matrix operation. Instead of a greedy loop, the "rescoring" of boxes is represented as a system of linear equations: $r \approx (I + P)^{-1}s$, where $s$ is the initial score and $P$ is a "Prune Matrix" based on overlaps.
2. Grouping and Masking
To avoid the computational complexity of inverting a massive matrix of all predicted boxes, the method groups boxes by object (using 2D IoU) and applies a binary mask. This allows the use of mathematical properties of Frobenius matrices, which simplifies the complex matrix inversion into a simple, efficient subtraction operation.
3. Differentiable Pruning
Traditional NMS uses a "hard" threshold where a box is either kept or discarded. GrooMeD-NMS replaces this with a differentiable pruning function (such as linear, exponential, or sigmoidal curves). This allows gradients to flow from the final "post-NMS" loss back through the entire network.
Experimental Results
The model was evaluated on the KITTI Vision Benchmark Suite, focusing on 3D Object Detection and Bird’s Eye View (BEV) tasks.
- State-of-the-Art Performance: GrooMeD-NMS outperformed all previous monocular 3D detectors on the KITTI benchmark. For the "Moderate" car category, it achieved 14.32% AP3D, a significant improvement over the M3D-RPN baseline (11.07%).
- Image vs. Video: This single-image method performed comparably to, and sometimes better than, sophisticated video-based methods that utilize temporal context from multiple frames.
- Improved Score Correlation: Training with GrooMeD-NMS resulted in a much higher correlation between a box's confidence score and its actual 3D accuracy, proving that the model learned to prioritize better-localized boxes.
Conclusion
GrooMeD-NMS successfully addresses the training-inference gap in object detection by making NMS differentiable. By forcing the network to "realize" when it has selected a poorly localized box as the winner, the model achieves superior 3D alignment. While demonstrated on monocular 3D detection, the generic nature of the GrooMeD-NMS layer suggests potential applications in LiDAR-based 3D detection and standard 2D detection tasks.
Summary updated