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

Abhinav Kumar, Garrick Brazil, Xiaoming Liu

Introduction

33D object detection is one of the fundamental problems in computer vision, where the task is to infer 33D information of the object. Its applications include augmented reality , robotics , medical surgery , and, more recently path planning and scene understanding in autonomous driving . Most of the 33D object detectors are extensions of the 22D object detector Faster R-CNN , which relies on the end-to-end learning idea to achieve State-of-the-Art (SoTA) object detection. Some of these methods have proposed changing architectures or losses . Others have tried incorporating confidence or temporal cues .

Almost all of them output a massive number of boxes for each object and, thus, rely on post-processing with a greedy clustering algorithm called Non-Maximal Suppression (NMS) during inference to reduce the number of false positives and increase performance. However, these works have largely overlooked NMS’s inclusion in training leading to an apparent mismatch between training and inference pipelines as the losses are applied on all boxes before NMS but not on final boxes after NMS (see Fig. 1(a)).We also find that 33D object detection suffers a greater mismatch between classification and 33D localization compared to that of 22D localization, as discussed further in Sec. A3.2 of the supplementary and observed in . Hence, our focus is 33D object detection.

Earlier attempts to include NMS in the training pipeline have been made for 22D object detection where the improvements are less visible. Recent efforts to improve the correlation in 33D object detection involve calculating or predicting the scores via likelihood estimation or enforcing the correlation explicitly . Although this improves the 33D detection performance, improvements are limited as their training pipeline is not end to end in the absence of a differentiable NMS.

To address the mismatch between training and inference pipelines as well as the mismatch between classification and 33D localization, we propose including the NMS in the training pipeline, which gives a useful gradient to the network so that it figures out which boxes are the best-localized in 33D and, therefore, should be ranked higher (see Fig. 1(b)).

An ideal NMS for inclusion in the training pipeline should be not only differentiable but also parallelizable. Unfortunately, the inference-based classical NMS and Soft-NMS are greedy, set-based and, therefore, not parallelizable . To make the NMS parallelizable, we first formulate the classical NMS as matrix operation and then obtain a closed-form mathematical expression using elementary matrix operations such as matrix multiplication, matrix inversion, and clipping. We then replace the threshold pruning in the classical NMS with its softer version to get useful gradients. These two changes make the NMS GPU-friendly, and the gradients are backpropagated. We next group and mask the boxes in an unsupervised manner, which removes the matrix inversion and simplifies our proposed differentiable NMS expression further. We call this NMS as Grouped Mathematically Differentiable Non-Maximal Suppression (GrooMeD-NMS).

In summary, the main contributions of this work include:

This is the first work to propose and integrate a closed-form mathematically differentiable NMS for object detection, such that the network is trained end-to-end with a loss on the boxes after NMS.

We propose an unsupervised grouping and masking on the boxes to remove the matrix inversion in the closed-form NMS expression.

We achieve SoTA monocular 33D object detection performance on the KITTI dataset performing comparably to monocular video-based methods.

Related Work

3D Object Detection. Recent success in 22D object detection has inspired people to infer 33D information from a single 22D (monocular) image. However, the monocular problem is ill-posed due to the inherent scale/depth ambiguity . Hence, approaches use additional sensors such as LiDAR , stereo or radar . Although LiDAR depth estimations are accurate, LiDAR data is sparse and computationally expensive to process . Moreover, LiDARs are expensive and do not work well in severe weather .

Hence, there have been several works on monocular 33D object detection. Earlier approaches use hand-crafted features, while the recent ones are all based on deep learning. Some of these methods have proposed changing architectures or losses . Others have tried incorporating confidence , augmentation , depth in convolution or temporal cues . Our work proposes to incorporate NMS in the training pipeline of monocular 33D object detection.

Non-Maximal Suppression. NMS has been used to reduce false positives in edge detection , feature point detection , face detection , human detection as well as SoTA 22D and 33D detection . Modifications to NMS in 22D detection , 22D pedestrian detection , 22D salient object detection and 33D detection can be classified into three categories – inference NMS , optimization-based NMS and neural network based NMS .

The inference NMS changes the way the boxes are pruned in the final set of predictions. uses weighted averaging to update the zz-coordinate after NMS. solves quadratic unconstrained binary optimization while and use point processes and MAP based inference respectively. and formulate NMS as a structured prediction task for isolated and all object instances respectively. The neural network NMS use a multi-layer network and message-passing to approximate NMS or to predict the NMS threshold adaptively . approximates the sub-gradients of the network without modelling NMS via a transitive relationship. Our work proposes a grouped closed-form mathematical approximation of the classical NMS and does not require multiple layers or message-passing. We detail these differences in Sec. 4.2.

Background

Let B ⁣= ⁣{bi}i=1n\mathcal{B}\!=\!\{b_{i}\}_{i=1}^{n} denote the set of boxes or proposals bib_{i} from an image. Let s ⁣= ⁣{si}i=1n{\bf s}\!=\!\{s_{i}\}_{i=1}^{n} and r ⁣= ⁣{ri}i=1n{\bf r}\!=\!\{r_{i}\}_{i=1}^{n} denote their scores (before NMS) and rescores (updated scores after NMS) respectively such that ri,si≥0 ∀ ir_{i},s_{i}\geq 0~{}\forall~{}i. D\mathcal{D} denotes the subset of B\mathcal{B} after the NMS. Let O=[oij]\mathbf{O}=[o_{ij}] denote the n×nn\times n matrix with oijo_{ij} denoting the 22D Intersection over Union (IoU2D{}_{2\text{D}}) of bib_{i} and bjb_{j}. The pruning function pp decides how to rescore a set of boxes B\mathcal{B} based on IoU2D{}_{2\text{D}} overlaps of its neighbors, sometimes suppressing boxes entirely. In other words, p(oi)=1p(o_{i})=1 denotes the box bib_{i} is suppressed while p(oi)=0p(o_{i})=0 denotes bib_{i} is kept in D\mathcal{D}. The NMS threshold NtN_{t} is the threshold for which two boxes need in order for the non-maximum to be suppressed. The temperature τ\tau controls the shape of the exponential and sigmoidal pruning functions pp. vv thresholds the rescores in GrooMeD and Soft-NMS to decide if the box remains valid after NMS.

∨\vee denotes the logical OR while ⌊x⌉\left\lfloor x\right\rceil denotes clipping of xx in the range $$. Formally,

2 Classical and Soft-NMS

NMS is one of the building blocks in object detection whose high-level goal is to iteratively suppress boxes which have too much IoU with a nearby high-scoring box. We first give an overview of the classical and Soft-NMS , which are greedy and used in inference. Classical NMS uses the idea that the score of a box having a high IoU2D{}_{2\text{D}} overlap with any of the selected boxes should be suppressed to zero. That is, it uses a hard pruning pp without any temperature τ\tau. Soft-NMS makes this pruning soft via temperature τ\tau. Thus, classical and Soft-NMS only differ in the choice of pp. We reproduce them in Alg. 1 using our notations.

GrooMeD-NMS

Classical NMS (Alg. 1) uses argmax⁡\operatornamewithlimits{argmax} and greedily calculates the rescore rir_{i} of boxes B\mathcal{B} and, is thus not parallelizable or differentiable . We wish to find its smooth approximation in closed-form for including in the training pipeline.

Classical NMS uses the non-differentiable hard argmax⁡\operatornamewithlimits{argmax} operation (Line 66 of Alg. 1). We remove the argmax⁡\operatornamewithlimits{argmax} by hard sorting the scores s{\bf s} and O\mathbf{O} in decreasing order (lines 22-33 of Alg. 2). We also try making the sorting soft. Note that we require the permutation of s{\bf s} to sort O\mathbf{O}. Most soft sorting methods apply the soft permutation to the same vector. Only two other methods can apply the soft permutation to another vector. Both methods use O(n2)\mathcal{O}\left(n^{2}\right) computations for soft sorting . We implement and find that is overly dependent on temperature τ\tau to break out the ranks, and its gradients are too unreliable to train our model. Hence, we stick with the hard sorting of s{\bf s} and O\mathbf{O}.

1.2 NMS as a Matrix Operation

The rescoring process of the classical NMS is greedy set-based and only considers overlaps with unsuppressed boxes. We first generalize this rescoring by accounting for the effect of all (suppressed and unsuppressed) boxes as

using the relaxation of logical OR ⋁\bigvee operator as ∑\sum . See Sec. A1 of the supplementary material for an alternate explanation of (2). The presence of rjr_{j} on the RHS of (2) prevents suppressed boxes from influencing other boxes hugely. When pp outputs discretely as {0,1}\{0,1\} as in classical NMS, scores sis_{i} are guaranteed to be suppressed to ri=0r_{i}=0 or left unchanged ri=sir_{i}=s_{i} thereby implying ri≤si ∀ ir_{i}\leq s_{i}~{}\forall~{}i. We write the rescores r{\bf r} in a matrix formulation as

The above two equations are written compactly as

as the solution to (5) with I{\bf{I}} being the identity matrix. Intuitively, if the matrix inversion is considered division in (6) and the boxes have overlaps, the rescores are the scores divided by a number greater than one and are, therefore, lesser than scores. If the boxes do not overlap, the division is by one and rescores equal scores.

Note that the I+P{\bf{I}}+{\bf{P}} in (6) is a lower triangular matrix with ones on the principal diagonal. Hence, I+P{\bf{I}}+{\bf{P}} is always full rank and, therefore, always invertible.

1.3 Grouping

We next observe that the object detectors output multiple boxes for an object, and a good detector outputs boxes wherever it finds objects in the monocular image. Thus, we cluster the boxes in an image in an unsupervised manner based on IoU2D{}_{2\text{D}} overlaps to obtain the groups G\mathcal{G}. Grouping thus mimics the grouping of the classical NMS, but does not rescore the boxes. As clustering limits interactions to intra-group interactions among the boxes, we write (6) as

This results in taking smaller matrix inverses in (7) than (6).

We use a simplistic grouping algorithm, i.e., we form a group Gk\mathcal{G}_{k} with boxes having high IoU2D{}_{2\text{D}} overlap with the top-ranked box, given that we sorted the scores. As the group size is limited by α\alpha, we choose a minimum of α\alpha and the number of boxes in Gk\mathcal{G}_{k}. We next delete all the boxes of this group and iterate until we run out of boxes. Also, grouping uses IoU2D{}_{2\text{D}} since we can achieve meaningful clustering in 22D. We detail this unsupervised grouping in Alg. 3.

1.4 Masking

Classical NMS considers the IoU2D{}_{2\text{D}} of the top-scored box with other boxes. This consideration is equivalent to only keeping the column of O\mathbf{O} corresponding to the top box while assigning the rest of the columns to be zero. We implement this through masking of PGk{\bf{P}}_{\mathcal{G}_{k}}. Let MGk{\bf{M}}_{\mathcal{G}_{k}} denote the binary mask corresponding to group Gk\mathcal{G}_{k}. Then, entries in the binary matrix MGk{\bf{M}}_{\mathcal{G}_{k}} in the column corresponding to the top-scored box are 11 and the rest are . Hence, only one of the columns in MGk ⁣⊙ PGk{\bf{M}}_{\mathcal{G}_{k}}\!\odot~{}{\bf{P}}_{\mathcal{G}_{k}} is non-zero. Now, IGk+MGk ⁣⊙PGk{\bf{I}}_{\mathcal{G}_{k}}+{\bf{M}}_{\mathcal{G}_{k}}\!\odot{\bf{P}}_{\mathcal{G}_{k}} is a Frobenius matrix (Gaussian transformation) and we, therefore, invert this matrix by simply subtracting the second term . In other words, (IGk+MGk ⁣⊙PGk)−1=IGk−MGk ⁣⊙PGk({\bf{I}}_{\mathcal{G}_{k}}+{\bf{M}}_{\mathcal{G}_{k}}\!\odot{\bf{P}}_{\mathcal{G}_{k}})^{-1}={\bf{I}}_{\mathcal{G}_{k}}-{\bf{M}}_{\mathcal{G}_{k}}\!\odot{\bf{P}}_{\mathcal{G}_{k}}. Hence, we simplify (7) further to get

Thus, masking allows to bypass the computationally expensive matrix inverse operation altogether.

We call the NMS based on (8) as Grouped Mathematically Differentiable Non-Maximal Suppression or GrooMeD-NMS. We summarize the complete GrooMeD-NMS in Alg. 2 and show its block-diagram in Fig. 1(c). GrooMeD-NMS in Fig. 1(c) provides two gradients - one through s{\bf s} and other through O\mathbf{O}.

1.5 Pruning Function

As explained in Sec. 3.1, the pruning function pp decides whether to keep the box in the final set of predictions D\mathcal{D} or not based on IoU2D{}_{2\text{D}} overlaps, i.e., p(oi)=1p(o_{i})=1 denotes the box bib_{i} is suppressed while p(oi)=0p(o_{i})=0 denotes bib_{i} is kept in D\mathcal{D}.

Classical NMS uses the threshold as the pruning function, which does not give useful gradients. Therefore, we considered three different functions for pp: Linear, a temperature (τ)(\tau)-controlled Exponential, and Sigmoidal function.

Linear Linear pruning function is p(o)=op(o)=o.

Sigmoidal Sigmoidal pruning function is p(o)=σ(o−Ntτ)p(o)=\sigma\left(\frac{o-N_{t}}{\tau}\right) with σ\sigma denoting the standard sigmoid. Sigmoidal function appears as the binary cross entropy relaxation of the subset selection problem .

We show these pruning functions in Fig. 2. The ablation studies (Sec. 5.4) show that choosing pp as Linear yields the simplest and the best GrooMeD-NMS.

2 Differences from Existing NMS

Although no differentiable NMS has been proposed for the monocular 33D object detection, we compare our GrooMeD-NMS with the NMS proposed for 22D object detection, 22D pedestrian detection, 22D salient object detection, and 33D object detection in Tab. 1. No method described in Tab. 1 has a matrix-based closed-form mathematical expression of the NMS. Classical, Soft and Distance-NMS are used at the inference time, while GrooMeD-NMS is used during both training and inference. Distance-NMS updates the zz-coordinate of the box after NMS as the weighted average of the zz-coordinates of top-κ\kappa boxes. QUBO-NMS , Point-NMS , and MAP-NMS are not used in end-to-end training. proposes a trainable Point-NMS. The Structured-SVM based NMS rely on structured SVM to obtain the rescores. Adaptive-NMS uses a separate neural network to predict the classical NMS threshold NtN_{t}. The trainable neural network based NMS (NN-NMS) use a separate neural network containing multiple layers and/or message-passing to approximate the NMS and do not use the pruning function. Unlike these methods, GrooMeD-NMS uses a single layer and does not require multiple layers or message passing. Our NMS is parallel up to group (denoted by G\mathcal{G}). However, ∣G∣\left|\mathcal{G}\right| is, in general, <<∣B∣<<\left|\mathcal{B}\right| in the NMS.

3 Target Assignment and Loss Function

Target Assignment. Our method consists of M3D-RPN and uses binning and self-balancing confidence . The boxes’ self-balancing confidence are used as scores s{\bf s}, which pass through the GrooMeD-NMS layer to obtain the rescores r{\bf r}. The rescores signal the network if the best box has not been selected for a particular object.

We extend the notion of the best 22D box to 33D. The best box has the highest product of IoU2D{}_{2\text{D}} and gIoU3D{}_{3\text{D}} with ground truth glg_{l}. If the product is greater than a certain threshold β\beta, it is assigned a positive label. Mathematically,

with q(b_{j},g_{l})=\text{IoU{}_{2\text{D}}}(b_{j},g_{l})~{}\left(\frac{1+\text{gIoU{}_{3\text{D}}}(b_{j},g_{l})}{2}\right). gIoU3D{}_{3\text{D}} is known to provide signal even for non-intersecting boxes , where the usual IoU3D{}_{3\text{D}} is always zero. Therefore, we use gIoU3D{}_{3\text{D}} instead of regular IoU3D{}_{3\text{D}} for figuring out the best box in 33D as many 33D boxes have a zero IoU3D{}_{3\text{D}} overlap with the ground truth. For calculating gIoU3D{}_{3\text{D}}, we first calculate the volume VV and hull volume VhullV_{hull} of the 33D boxes. VhullV_{hull} is the product of gIoU2D{}_{2\text{D}} in Birds Eye View (BEV), removing the rotations and hull of the YY dimension. gIoU3D{}_{3\text{D}} is then given by

Loss Function. Generally the number of best boxes is less than the number of ground truths in an image, as there could be some ground truth boxes for which no box is predicted. The tiny number of best boxes introduces a far-heavier skew than the foreground-background classification. Thus, we use the modified AP-Loss as our loss after NMS since AP-Loss does not suffer from class imbalance .

Vanilla AP-Loss treats boxes of all images in a mini-batch equally, and the gradients are back-propagated through all the boxes. We remove this condition and rank boxes in an image-wise manner. In other words, if the best boxes are correctly ranked in one image and are not in the second, then the gradients only affect the boxes of the second image. We call this modification of AP-Loss as Imagewise AP-Loss. In other words,

where r(m){\bf r}^{(m)} and B(m)\mathcal{B}^{(m)} denote the rescores and the boxes of the mthm^{\text{th}} image in a mini-batch respectively. This is different from previous NMS approaches , which use classification losses. Our ablation studies (Sec. 5.4) show that the Imagewise AP-Loss is better suited to be used after NMS than the classification loss.

Our overall loss function is thus given by L=Lbefore+λLafter\mathcal{L}=\mathcal{L}_{before}+\lambda\mathcal{L}_{after} where Lbefore\mathcal{L}_{before} denotes the losses before the NMS including classification, 22D and 33D regression as well as confidence losses, and Lafter\mathcal{L}_{after} denotes the loss term after the NMS, which is the Imagewise AP-Loss with λ\lambda being the weight. See Sec. A2 of the supplementary material for more details of the loss function.

Experiments

Our experiments use the most widely used KITTI autonomous driving dataset . We modify the publicly-available PyTorch code of Kinematic-3D . uses DenseNet-121 trained on ImageNet as the backbone and nh ⁣= ⁣1,024n_{h}\!=\!1{,}024 using 33D-RPN settings of . As is a video-based method while GrooMeD-NMS is an image-based method, we use the best image model of henceforth called Kinematic (Image) as our baseline for a fair comparison. Kinematic (Image) is built on M3D-RPN and uses binning and self-balancing confidence.

Data Splits. There are three commonly used data splits of the KITTI dataset; we evaluate our method on all three.

Test Split: Official KITTI 33D benchmark consists of 7,4817{,}481 training and 7,5187{,}518 testing images .

Val 1 Split: It partitions the 7,4817{,}481 training images into 3,7123{,}712 training and 3,7693{,}769 validation images .

Val 2 Split: It partitions the 7,4817{,}481 training images into 3,6823{,}682 training and 3,7993{,}799 validation images .

Training. Training is done in two phases - warmup and full . We initialize the model with the confidence prediction branch from warmup weights and finetune using the self-balancing loss and Imagewise AP-Loss after our GrooMeD-NMS. See Sec. A3.1 of the supplementary material for more training details. We keep the weight λ\lambda at 0.050.05. Unless otherwise stated, we use pp as the Linear function (this does not require τ\tau) with α=100\alpha=100. Nt,vN_{t},v and β\beta are set to 0.40.4 , 0.30.3 and 0.30.3 respectively.

Inference. We multiply the class and predicted confidence to get the box’s overall score in inference as in . See Sec. 5.2 for training and inference times.

Evaluation Metrics. KITTI uses AP3D∣R40{}_{3\text{D}|R_{40}} metric to evaluate object detection following . KITTI benchmark evaluates on three object categories: Easy, Moderate and Hard. It assigns each object to a category based on its occlusion, truncation, and height in the image space. The AP3D∣R40{}_{3\text{D}|R_{40}} performance on the Moderate category compares different models in the benchmark . We focus primarily on the Car class following .

Tab. 2 summarizes the results of 33D object detection and BEV evaluation on KITTI Test Split. The results in Tab. 2 show that GrooMeD-NMS outperforms the baseline M3D-RPN by a significant margin and several other SoTA methods on both the tasks. GrooMeD-NMS also outperforms augmentation based approach MoVi-3D and depth-convolution based D4LCN . Despite being an image-based method, GrooMeD-NMS performs competitively to the video-based method Kinematic (Video) , outperforming it on the most-challenging Hard set.

2 KITTI Val 1 3D Object Detection

Results. Tab. 3 summarizes the results of 33D object detection and BEV evaluation on KITTI Val 1 Split at two IoU3D{}_{3\text{D}} thresholds of 0.70.7 and 0.50.5 . The results in Tab. 3 show that GrooMeD-NMS outperforms the baseline of M3D-RPN and Kinematic (Image) by a significant margin. Interestingly, GrooMeD-NMS (an image-based method) also outperforms the video-based method Kinematic (Video) on most of the metrics. Thus, GrooMeD-NMS performs best on 66 out of the 1212 cases (33 categories × 2\times~{}2 tasks × 2\times~{}2 thresholds) while second-best on all other cases. The performance is especially impressive since the biggest improvements are shown on the Moderate and Hard set, where objects are more distant and occluded.

AP3D{}_{3\text{D}} at different depths and IoU3D{}_{3\text{D}} thresholds. We next compare the AP3D{}_{3\text{D}} performance of GrooMeD-NMS and Kinematic (Image) on linear and log scale for objects at different depths of $metersandIoUmeters and IoU{}_{3\text{D}}matchingcriteriaofmatching criteria of0.3\!\relbar\joinrel\mathrel{\RHD}\!0.7inFig.3asin.Fig.3showsthatGrooMeD−NMSoutperformstheKinematic(Image)atalldepthsandallIoUin Fig. 3 as in . Fig. 3 shows that GrooMeD-NMS outperforms the Kinematic (Image) at all depths and all IoU{}_{3\text{D}}$ thresholds.

Comparisons with other NMS. We compare with the classical NMS, Soft-NMS and Distance-NMS in Tab. 4. More detailed results are in Tab. 8 of the supplementary material. The results show that NMS inclusion in the training pipeline benefits the performance, unlike , which suggests otherwise. Training with GrooMeD-NMS helps because the network gets an additional signal through the GrooMeD-NMS layer whenever the best-localized box corresponding to an object is not selected. Interestingly, Tab. 4 also suggests that replacing GrooMeD-NMS with the classical NMS in inference does not affect the performance.

Score-IoU3D{}_{3\text{D}} Plot. We further correlate the scores with IoU3D{}_{3\text{D}} after NMS of our model with two baselines - M3D-RPN and Kinematic (Image) and also the Kinematic (Video) in Fig. 4. We obtain the best correlation of 0.3450.345 exceeding the correlations of M3D-RPN, Kinematic (Image) and, also Kinematic (Video). This proves that including NMS in the training pipeline is beneficial.

Training and Inference Times. We now compare the training and inference times of including GrooMeD-NMS in the pipeline. Warmup training phase takes about 1313 hours to train on a single 1212 GB GeForce GTX Titan-X GPU. Full training phase of Kinematic (Image) and GrooMeD-NMS takes about 88 and 8.58.5 hours respectively. The inference time per image using classical and GrooMeD-NMS is 0.120.12 and 0.150.15 ms respectively. Tab. 4 suggests that changing the NMS from GrooMeD to classical during inference does not alter the performance. Then, the inference time of our method is the same as 0.120.12 ms.

3 KITTI Val 2 3D Object Detection

Tab. 5 summarizes the results of 33D object detection and BEV evaluation on KITTI Val 2 Split at two IoU3D{}_{3\text{D}} thresholds of 0.70.7 and 0.50.5 . Again, we use M3D-RPN and Kinematic (Image) as our baselines. We evaluate the released model of M3D-RPN using the KITTI metric. does not report Val 2 results, so we retrain on Val 2 using their public code. The results in Tab. 5 show that GrooMeD-NMS performs best in all cases. This is again impressive because the improvements are shown on Moderate and Hard set, consistent with Tabs. 2 and 3.

4 Ablation Studies

Tab. 6 compares the modifications of our approach on KITTI Val 1 Cars. Unless stated otherwise, we stick with the experimental settings described in Sec. 5. Using a confidence head (Conf+No NMS) proves beneficial compared to the warmup model (No Conf+No NMS), which is consistent with the observations of . Further, GrooMeD-NMS on classification scores (denoted by No Conf + NMS) is detrimental as the classification scores are not suited for localization . Training the warmup model and then finetuning also works better than training without warmup as in since the warmup phase allows GrooMeD-NMS to carry meaningful grouping of the boxes.

As described in Sec. 4.1.5, in addition to Linear, we compare two other functions for pruning function pp: Exponential and Sigmoidal. Both of them do not perform as well as the Linear pp possibly because they have vanishing gradients close to overlap of zero or one. Grouping and masking both help our model to reach a better minimum. As described in Sec. 4.3, Imagewise AP loss is better than the Vanilla AP loss since it treats boxes of two images differently. Imagewise AP also performs better than the binary cross-entropy (BCE) loss proposed in . Using the product of self-balancing confidence and classification scores instead of using them individually as the scores to the NMS in inference is better, consistent with . Class confidence performs worse since it does not have the localization information while the self-balancing confidence (Pred) gives the localization without considering whether the box belongs to foreground or background.

Conclusions

In this paper, we present and integrate GrooMeD-NMS – a novel Grouped Mathematically Differentiable NMS for monocular 33D 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 do unsupervised grouping and masking of the boxes 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 33D box in a differentiable manner. As a result, GrooMeD-NMS achieves state-of-the-art monocular 33D object detection results on the KITTI benchmark dataset. Although our implementation demonstrates monocular 33D object detection, GrooMeD-NMS is fairly generic for other object detection tasks. Future work includes applying this method to tasks such as LiDAR-based 33D object detection and pedestrian detection.

References

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

Appendix A1 Detailed Explanation of NMS as a Matrix Operation

The rescoring process of the classical NMS is greedy set-based and calculates the rescore for a box ii (Line 1010 of Alg. 1) as

where d<i\mathbf{d}_{<i} is defined as the box indices sampled from d\mathbf{d} having higher scores than box ii. For example, let us consider that d={1,5,7,9}\mathbf{d}=\{1,5,7,9\}. Then, for i=7, d<i={1,5}i=7,~{}\mathbf{d}_{<i}=\{1,5\} while for i=1,d<i=ϕi=1,\mathbf{d}_{<i}=\phi with ϕ\phi denoting the empty set. This is possible since we had sorted the scores s{\bf s} and O\mathbf{O} in decreasing order (Lines 22-33 of Alg. 2) to remove the non-differentiable hard argmax⁡\operatornamewithlimits{argmax} operation of the classical NMS (Line 66 of Alg. 1).

Classical NMS only takes the overlap with unsuppressed boxes into account. Therefore, we generalize (15) by accounting for the effect of all (suppressed and unsuppressed) boxes as

The presence of rjr_{j} on the RHS of (16) prevents suppressed boxes rj≈0r_{j}\approx 0 from influencing other boxes hugely. Let us say we have a box b2b_{2} with a high overlap with an unsuppressed box b1b_{1}. The classical NMS with a threshold pruning function assigns r2=0r_{2}=0 while (16) assigns r2r_{2} a small non-zero value with a threshold pruning.

Although (16) keeps ri≥0r_{i}\geq 0, getting a closed-form recursion in r{\bf r} is not easy because of the product operation. To get a closed-form recursion with addition/subtraction in r{\bf r}, we first carry out the polynomial multiplication and then ignore the higher-order terms as

Dropping the sis_{i} in the second term of (17) helps us get a cleaner form of (22). Moreover, it does not change the nature of the NMS since the subtraction keeps the relation ri≤sir_{i}\leq s_{i} intact as p(oij)p(o_{ij}) and rjr_{j} are both between $$.

We can also reach (17) directly as follows. Classical NMS suppresses a box which has a high IoU2D{}_{2\text{D}} overlap with any of the unsuppressed boxes (rj≈1r_{j}\approx 1) to zero. We consider any as a logical non-differentiable OR operation and use logical OR ⋁\bigvee operator’s differentiable relaxation as ∑\sum . We next use this relaxation with the other expression r≤s{\bf r}\leq{\bf s}.

When a box shows overlap with more than two unsuppressed boxes, the term ∑j=1i−1p(oij)rj>1\sum\limits_{j=1}^{i-1}p(o_{ij})r_{j}>1 in (17) or when a box shows high overlap with one unsuppressed box, the term si<p(oij)rjs_{i}<p(o_{ij})r_{j}. In both of these cases, ri<0r_{i}<0. So, we lower bound (17) with a max⁡\max operation to ensure that ri≥0r_{i}\geq 0. Thus,

We write the rescores r{\bf r} in a matrix formulation as

We next write the above two equations compactly as

However, for a differentiable NMS layer, we need to avoid the recursion. Therefore, we first solve (21) assuming the max⁡\max operation is not present which gives us the solution r≈(I+P)−1s{\bf r}\approx\left({\bf{I}}+{\bf{P}}\right)^{-1}{\bf s}. In general, this solution is not necessarily bounded between and 11. Hence, we clip it explicitly to obtain the approximation

Appendix A2 Loss Functions

We now detail out the loss functions used for training. The losses on the boxes before NMS, Lbefore\mathcal{L}_{before}, is given by

bconfb_{conf} is the predicted self-balancing confidence of each box bb, while bθab_{\theta_{a}} and bθhb_{\theta_{h}} are its orientation bins . gg denotes the ground-truth. λconf\lambda_{conf} is the rolling mean of most recent L3D\mathcal{L}_{3\text{D}} losses per mini-batch , while λa\lambda_{a} denotes the weight of the orientation bins loss. CE and Smoooth-L1 denote the Cross Entropy and Smooth L1 loss respectively. Note that we apply 22D and 33D regression losses as well as the confidence losses only on the foreground boxes.

As explained in Sec. 4.3, the loss on the boxes after NMS, Lafter\mathcal{L}_{after}, is the Imagewise AP-Loss, which is given by

Let λ\lambda be the weight of the Lafter\mathcal{L}_{after} term. Then, our overall loss function is given by

We keep λa=0.35\lambda_{a}=0.35 following and λ=0.05\lambda=0.05. Clearly, all our losses and their weights are identical to except LImagewise\mathcal{L}_{Imagewise}.

Appendix A3 Additional Experiments and Results

We now provide additional details and results evaluating our system’s performance.

Training images are augmented using random flipping with probability 0.50.5 . Adam optimizer is used with batch size 22, weight-decay 5×10−45\times 10^{-4} and gradient clipping of 11 . Warmup starts with a learning rate 4×10−34\times 10^{-3} following a poly learning policy with power 0.90.9 . Warmup and full training phases take 80k80k and 50k50k mini-batches respectively for Val 1 and Val 2 Splits while take 160k160k and 100k100k mini-batches for Test Split.

A3.2 KITTI Val 1 Oracle NMS Experiments

As discussed in Sec. 1, to understand the effects of an inference-only NMS on 22D and 33D object detection, we conduct a series of oracle experiments. We create an oracle NMS by taking the Val Car boxes of KITTI Val 1 Split from the baseline Kinematic (Image) model before NMS and replace their scores with their true IoU2D{}_{2\text{D}} or IoU3D{}_{3\text{D}} with the ground-truth, respectively. Note that this corresponds to the oracle because we do not know the ground-truth boxes during inference. We then pass the boxes with the oracle scores through the classical NMS and report the results in Tab. 7.

The results show that the AP3D{}_{3\text{D}} increases by a staggering >60>60 AP on Mod cars when we use oracle IoU3D{}_{3\text{D}} as the NMS score. On the other hand, we only see an increase in AP2D{}_{2\text{D}} by ≈11\approx 11 AP on Mod cars when we use oracle IoU2D{}_{2\text{D}} as the NMS score. Thus, the relative effect of using oracle IoU3D{}_{3\text{D}} NMS scores on 33D detection is more significant than using oracle IoU2D{}_{2\text{D}} NMS scores on 22D detection. In other words, the mismatch is greater between classification and 33D localization compared to the mismatch between classification and 22D localization.

A3.3 KITTI Val 1 3D Object Detection

Comparisons with other NMS. We compare our method with the other NMS—classical, Soft and Distance-NMS and report the detailed results in Tab. 8. We use the publicly released Soft-NMS code and Distance-NMS code from the respective authors. The Distance-NMS model uses the class confidence scores divided by the uncertainty in zz (the most erroneous dimension in 33D localization ) of a box as the Distance-NMS input. Our model does not predict the uncertainty in zz of a box but predicts its self-balancing confidence (the 33D localization score). Therefore, we use the class confidence scores multiplied by the self-balancing confidence as the Distance-NMS input.

The results in Tab. 8 show that NMS inclusion in the training pipeline benefits the performance, unlike , which suggests otherwise. Training with GrooMeD-NMS helps because the network gets an additional signal through the GrooMeD-NMS layer whenever the best-localized box corresponding to an object is not selected. Moreover, Tab. 8 suggests that we can replace GrooMeD-NMS with the classical NMS in inference as the performance is almost the same even at IoU3D{}_{3\text{D}}=0.5=0.5.

How good is the classical NMS approximation? GrooMeD-NMS uses several approximations to arrive at the matrix solution (22). We now compare how good these approximations are with the classical NMS. Interestingly, Tab. 8 shows that GrooMeD-NMS is an excellent approximation to the classical NMS as the performance does not degrade after changing the NMS in inference.

A3.4 KITTI Val 1 Sensitivity Analysis

There are a few adjustable parameters for the GrooMeD-NMS, such as the NMS threshold NtN_{t}, valid box threshold vv, the maximum group size α\alpha, the weight λ\lambda for the Lafter\mathcal{L}_{after}, and β\beta. We carry out a sensitivity analysis to understand how these parameters affect performance and speed, and how sensitive the algorithm is to these parameters.

Sensitivity to NMS Threshold. We show the sensitivity to NMS threshold NtN_{t} in Tab. 9. The results in Tab. 9 show that the optimal Nt=0.4N_{t}=0.4. This is also the NtN_{t} in .

Sensitivity to Valid Box Threshold. We next show the sensitivity to valid box threshold vv in Tab. 10. Our choice of v=0.3v=0.3 performs close to the optimal choice.

Sensitivity to Maximum Group Size. Grouping has a parameter group size (α)(\alpha). We vary this parameter and report AP3D∣R40{}_{3\text{D}|R_{40}} and APBEV∣R40{}_{\text{BEV}|R_{40}} at two different IoU3D{}_{3\text{D}} thresholds on Moderate Cars of KITTI Val 1 Split in Fig. 5. We note that the best AP3D∣R40{}_{3\text{D}|R_{40}} performance is obtained at α=100\alpha=100 and we, therefore, set α=100\alpha=100 in our experiments.

Sensitivity to Loss Weight. We now show the sensitivity to loss weight λ\lambda in Tab. 11. Our choice of λ=0.05\lambda=0.05 is the optimal value.

Sensitivity to Best Box Threshold. We now show the sensitivity to the best box threshold β\beta in Tab. 12. Our choice of β=0.3\beta=0.3 is the optimal value.

Conclusion. Our method has minor sensitivity to Nt,α,λN_{t},\alpha,\lambda and β\beta, which is common in object detection. Our method is not as sensitive to vv since it only decides a box’s validity. Our parameter choice is either at or close to the optimal. The inference speed is only affected by α\alpha. Other parameters are used in training or do not affect inference speed.

A3.5 Qualitative Results

We next show some qualitative results of models trained on KITTI Val 1 Split in Fig. 6. We depict the predictions of GrooMeD-NMS in image view on the left and the predictions of GrooMeD-NMS, Kinematic (Image) , and ground truth in BEV on the right. In general, GrooMeD-NMS predictions are more closer to the ground truth than Kinematic (Image) .

A3.6 Demo Video of GrooMeD-NMS

We next include a short demo video of our GrooMeD-NMS model trained on KITTI Val 1 Split. We run our trained model independently on each frame of the three KITTI raw sequences - 2011_10_03_drive_0047, 2011_09_29_drive_0026 and 2011_09_26_drive_0009. None of the frames from these three raw sequences appear in the training set of KITTI Val 1 Split. We use the camera matrices available with the raw sequences but do not use any temporal information. Overlaid on each frame of the raw input videos, we plot the projected 33D boxes of the predictions and also plot these 33D boxes in the BEV. We set the frame rate of this demo at 1010 fps. The demo is also available in HD at https://www.youtube.com/watch?v=PWctKkyWrno. In the demo video, notice that the orientation of the boxes are stable despite not using any temporal information.

Acknowledgements

This research was partially sponsored by Ford Motor Company and the Army Research Office under Grant Number W911NF-18-1-0330. This document’s views and conclusions are those of the authors and do not represent the official policies, either expressed or implied, of the Army Research Office or the U.S. Government.

We thank Mathieu Blondel and Quentin Berthet from Google Brain, Paris, for several useful discussions on differentiable ranking and sorting. We also discussed the logical operators’ relaxation with Ashim Gupta from the University of Utah. Armin Parchami from Ford Motor Company suggested the learnable NMS paper . Enrique Corona and Marcos Paul Gerardo Castro from Ford Motor Company provided feedback during the development of this work. Shengjie Zhu from the Computer Vision Lab at Michigan State University proof-read our manuscript and suggested several changes. We also thank Xuepeng Shi from University College London for sharing the Distance-NMS code for bench-marking. We finally acknowledge anonymous reviewers for their feedback that helped in shaping the final manuscript.