MonoPair: Monocular 3D Object Detection Using Pairwise Spatial Relationships

Yongjian Chen, Lei Tai, Kai Sun, Mingyang Li

Introduction

3D object detection plays an essential role in various computer vision applications such as autonomous driving, unmanned aircrafts, robotic manipulation, and augmented reality. In this paper, we tackle this problem by using a monocular camera, primarily for autonomous driving use cases. Most existing methods on 3D object detection require accurate depth information, which can be obtained from either 3D LiDARs or multi-camera systems . Due to the lack of directly computable depth information, 3D object detection using a monocular camera is generally considered a much more challenging problem than using LiDARs or multi-camera systems. Despite the difficulties in computer vision algorithm design, solutions relying on a monocular camera can potentially allow for low-cost, low-power, and deployment-flexible systems in real applications. Therefore, there is a growing trend on performing monocular 3D object detection in research community in recent years .

Existing monocular 3D object detection methods have achieved considerable high accuracy for normal objects in autonomous driving. However, in real scenarios, there are a large number of objects that are under heavy occlusions, which pose significant algorithmic challenges. Unlike objects in the foreground which are fully visible, useful information for occluded objects is naturally limited. Straightforward methods on solving this problem are to design networks to exploit useful information as much as possible, which however only lead to limited improvement. Inspired by image captioning methods which seek to use scene graph and object relationships , we propose to fully leverage the spatial relationship between close-by objects instead of individually focusing on information-constrained occluded objects. This is well aligned with human’s intuition that human beings can naturally infer positions of the occluded cars from their neighbors on busy streets.

Mathematically, our key idea is to optimize the predicted 3D locations of objects guided by their uncertainty-aware spatial constraints. Specifically, we propose a novel detector to jointly compute object locations and spatial constraints between matched object pairs. The pairwise spatial constraint is modeled as a keypoint located in the geometric center between two neighboring objects, which effectively encodes all necessary geometric information. By doing that, it enables the network to capture the geometric context among objects explicitly. During the prediction, we impose aleatoric uncertainty into the baseline 3D object detector to model the noise of the output. The uncertainty is learned in an unsupervised manner, which is able to enhance the network robustness properties significantly. Finally, we formulate the predicted 3D locations as well as their pairwise spatial constraints into a nonlinear least squares problem to optimize the locations with a graph optimization framework. The computed uncertainties are used to weight each term in the cost function. Experiments on challenging KITTI 3D datasets demonstrate that our method outperforms the state-of-the-art competing approaches by wide margins. We also note that for hard samples with heavier occlusions, our method demonstrates massive improvement. In summary, the key contributions of this paper are as follows:

We design a novel 3D object detector using a monocular camera by capturing spatial relationships between paired objects, allowing largely improved accuracy on occluded objects.

We propose an uncertainty-aware prediction module in 3D object detection, which is jointly optimized together with object-to-object distances.

Experiments demonstrate that our method yields the best performance on KITTI 3D detection benchmark, by outperforming state-of-the-art competitors by wide margins.

Related Work

In this section, we first review methods on monocular 3D object detection for autonomous driving. Related algorithms on object relationship and uncertainty estimation are also briefly discussed.

Monocular 3D Object Detection. Monocular image is naturally of limited 3D information compared with multi-beam LiDAR or stereo vision. Prior knowledge or auxiliary information are widely used for 3D object detection. Mono3D focuses on the fact that 3D objects are on the ground plane. Prior 3D shapes of vehicles are also leveraged to reconstruct the bounding box for autonomous driving . Deep MANTA predicts 3D object information utilizing key points and 3D CAD models. SubCNN learns viewpoint-dependent subcategories from 3D CAD models to capture both shape, viewpoint and occlusion patterns. In , the network learns to estimate correspondences between detected 2D keypoints and 3D counterparts. 3D-RCNN introduces an inverse-graphics framework for all object instances from an image. A differentiable Render-and-Compare loss allows 3D results to be learned through 2D information. In , a sparse LiDAR scan is used in the training stage to generate training data, which removes the necessity of using inconvenient CAD dataset. An alternative family of methods is to predict a stand-alone depth or disparity information of the monocular image at the first stage . Although they only require the monocular image at testing time, ground-truth depth information is still necessary for the model training.

Compared with the aforementioned works in monocular 3D detection, some algorithms consist of only the RGB image as input rather than relying on external data, network structures or pre-trained models. Deep3DBox infers 3D information from a 2D bounding box considering the geometrical constraints of projection. OFTNet presents a orthographic feature transform to map image-based features into an orthographic 3D space. ROI-10D proposes a novel loss to properly measure the metric misalignment of boxes. MonoGRNet predicts 3D object localizations from a monocular RGB image considering geometric reasoning in 2D projection and the unobserved depth dimension. Current state-of-the-art results for monocular 3D object detection are from MonoDIS and M3D-RPN . Among them, MonoDIS leverages a novel disentangling transformation for 2D and 3D detection losses, which simplifies the training dynamics. M3D-RPN reformulates the monocular 3D detection problem as a standalone 3D region proposal network. However, all the object detectors mentioned above focus on predicting each individual object from the image. The spatial relationship among objects is not considered. Our work is originally inspired by CenterNet , in which each object is identified by points. Specifically, we model the geometric relationship between objects by using a single point similar to CenterNet, which is effectively the geometric center between them.

Visual Relationship Detection. Relationship plays an essential role for image understanding. To date, it is widely applied in image captioning. Dai et al. proposes a relational network to exploit the statistical dependencies between objects and their relationships. MSDB presents a multi-level scene description network to learn features of different semantic levels. Yao et al. proposes an attention-based encoder-decoder framework. through graph convolutional networks and long short-term memory (LSTM) for scene generation. However, these methods are mainly for tackling the effects of visual relationships in representing and describing an image. They usually extract object proposals directly or show full trust for the predicted bounding boxes. By contrast, our method focuses 3D object detection, which is to refine the detection results based on spatial relationships. This is un-explored in existing work.

Uncertainty Estimation in object detection. The computed object locations and pairwise 3D distances of our method are all predicted with uncertainties. This is inspired by the aleatoric uncertainty of deep neural networks . Instead of fully trusting the results of deep neural networks, we can extract how uncertain the predictions. This is crucial for various perception and decision making tasks, especially for autonomous driving, where human lives may be endangered due to inappropriate choices. This concept has been applied in 3D Lidar object detection and pedestrian localization , where they mainly consider uncertainties as additional information for reference. In , uncertainty is used to approximate object hulls with bounded collision probability for subsequent trajectory planning tasks. Gaussian-YOLO significantly improves the detection results by predicting the localization uncertainty. These approaches only use uncertainty to improve the training quality or to provide an additional reference. By contrast, we use uncertainty to weight the cost function for post-optimization, integrating the detection estimates and predicted uncertainties in global context optimization.

Approach

We adopt a one-stage architecture, which shares a similar structure with state-of-the-art anchor-free 2D object detectors . As shown in Figure 1, it is composed of a backbone network and several task-specific dense prediction branches. The backbone takes a monocular image II with a size of (Ws×Hs)(Ws\times Hs) as input, and outputs the feature map with a size of (W×H×64)(W\times H\times 64), where ss is our backbone’s down-sampling factor. There are eleven output branches with a size of W×H×mW\times H\times m, where mm means the channel of each output branch, as shown in Figure 1. Eleven output branches are divided into three parts: three for 2D object detection, six for 3D object detection, and two for pairwise constraint prediction. We introduce each module in details as follows.

2 2D Detection

Our 2D detection module is derived from the CenterNet with three output branches. The heatmap with a size of (W×H×cW\times H\times c) is used for keypoint localization and classification. Keypoint types include c=3c=3 in KITTI3D object detection. Details about extracting the object location cg=(ug,vg)\mathbf{c}^{g}=(u^{g},v^{g}) from the output heatmap can be referred in . The other two branches, with two channels for each, output the size of the bounding box (wb,hb)(w^{b},h^{b}) and the offset vector (δu,δv)(\delta^{u},\delta^{v}) from the located keypoint cg\mathbf{c}^{g} to the bounding box center cb=(ub,vb)\mathbf{c}^{b}=(u^{b},v^{b}) respectively. As shown in Figure 2, those values are in units of the feature map coordinate.

3 3D Detection

The object center in world space is represented as cw=(x,y,z)\mathbf{c}^{w}=(x,y,z). Its projection in the feature map is co=(u,v)\mathbf{c}^{o}=(u,v) as shown in Figure 2. Similar to , we predict its offset (Δu,Δv)(\Delta^{u},\Delta^{v}) to the keypoint location cg\mathbf{c}^{g} and the depth zz in two separate branches. With the camera intrinsic matrix K\mathbf{K}, the derivation from predictions to the 3D center cw\mathbf{c}^{w} is as follows:

Given the difficulty to regress depth directly, depth prediction branch outputs inverse depth z^\hat{z} similar to , transforming the absolute depth by inverse sigmoid transformation z=1/σ(z^)1z=1/\sigma(\hat{z})-1. The dimension branch regresses the size (w,h,l)(w,h,l) of the object in meters directly. The branches for depth, offset and dimensions in both 2D and 3D detection are trained with the L1 loss following .

As presented in Figure 2, we estimate the object’s local orientation α\alpha following and . Compared to global orientation β\beta in the camera coordinate system, the local orientation accounts for the relative rotation of the object to the camera viewing angle γ=arctan(x/z)\gamma=\arctan(x/z). Therefore, using the local orientation is more meaningful when dealing with image features. Similar to , we represent the orientation using eight scalars, where the orientation branch is trained by MultiBinMultiBin loss.

4 Pairwise Spatial Constraint

In addition to the regular 2D and 3D detection pipelines, we propose a novel regression target, which is to estimate the pairwise geometric constraint among adjacent objects via a keypoint on the feature map. Pair matching strategy for training and inference is shown in Figure 4(a). For arbitrary sample pair, we define a range circle by setting the distance of their 2D bounding box centers as the diameter. This pair is neglected if it contains other object centers. Figure 4(b) shows an example image with all effective sample pairs.

Given a selected pair of objects, their 3D centers in world space are ciw=(xi,yi,zi)\mathbf{c}^{w}_{i}=(x_{i},y_{i},z_{i}) and cjw=(xj,yj,zj)\mathbf{c}^{w}_{j}=(x_{j},y_{j},z_{j}) and their 2D bounding box centers on the feature map are cib=(uib,vib)\mathbf{c}^{b}_{i}=(u^{b}_{i},v^{b}_{i}) and cjb=(ujb,vjb)\mathbf{c}^{b}_{j}=(u^{b}_{j},v^{b}_{j}) . The pairwise constraint keypoint locates on the feature map as pijb=(cib+cjb)/2\mathbf{p}^{b}_{ij}=(\mathbf{c}^{b}_{i}+\mathbf{c}^{b}_{j})/2. The regression target for the related keypoint is the 3D distance of these two objects. We first locate the middle point pijw=(ciw+cjw)/2=(pxw,pyw,pzw)ij\mathbf{p}^{w}_{ij}=(\mathbf{c}^{w}_{i}+\mathbf{c}^{w}_{j})/2=(p^{w}_{x},p^{w}_{y},p^{w}_{z})_{ij} in 3D space. Then, the 3D absolute distance kijv=(kxv,kyv,kzv)ij\mathbf{k}^{v}_{ij}=(k^{v}_{x},k^{v}_{y},k^{v}_{z})_{ij} along the view point direction, as shown in Figure 3(b), are taken as the regression target which is the distance branch of the pair constraint output in Figure 1. Notice that pb\mathbf{p}^{b} is not the projected point of pw\mathbf{p}^{w} on the feature map, like cw\mathbf{c}^{w} and cb\mathbf{c}^{b} in Figure 2.

For training, kijv\mathbf{k}^{v}_{ij} can be easily collected through the groundtruth 3D object centers from the training data as:

where   \overrightarrow{\left|~{}\cdot~{}\right|} means extract absolute value of each entry in the vector. kijw=ciwcjw\mathbf{k}^{w}_{ij}=\mathbf{c}^{w}_{i}-\mathbf{c}^{w}_{j} is the 3D distance in camera coordinate, γij=arctan(pxw/pzw)\gamma_{ij}=\arctan(p^{w}_{x}/p^{w}_{z}) is the view direction of their middle point pijw\mathbf{p}^{w}_{ij}, and R(γij)\mathbf{R}(\gamma_{ij}) is its rotation matrix along the Y\mathbf{Y} axis as

The 3D distance kw\mathbf{k}^{w} in camera coordinate is not considered because it is invariant from different view angles, as shown in Figure 5(a). As in estimation of the orientation γ\gamma, 3D absolute distance kv\mathbf{k}^{v} in the local coordinate of pw\mathbf{p}^{w} is more meaningful considering the appearance change through viewing angles.

5 Uncertainty

Following the heteroscedastic aleatoric uncertainty setup in , we represent a regression task with L1 loss as

6 Spatial Constraint Optimization

As the main contribution of this paper, we propose a post-optimization process from a graph perspective. Suppose that in one image, the network outputs NN effective objects, and there are MM pair constraints among them based on the strategy in Section 3. Those paired objects are regarded as vertices {ξi}i=1NG{\{\mathbf{\xi}_{i}\}^{N^{\mathcal{G}}}_{i=1}} with size of NGN^{\mathcal{G}} and the MM paired constraints are regarded as edges of the graph. Each vertex may connect multiple neighbors. Predicted objects not connected by other vertices are not updated anymore in the post-optimization. The proposed spatial constraint optimization is formulated as a nonlinear least square problem as

where e\mathbf{e} is the error vector and W\mathbf{W} is the weight matrix for different errors. W\mathbf{W} is a diagonal matrix with dimension 3NG+3M3N^{\mathcal{G}}+3M. For each vertex ξi\mathbf{\xi}_{i}, there are three variables (ui,vi,zi)(u_{i},v_{i},z_{i}), which are the projected center (ui,vi)(u_{i},v_{i}) of the 3D bounding box on the feature map and the depth ziz_{i} as shown in Figure 2. We introduce each minimization term in the following.

Object Location Error For each vertex ξi\mathbf{\xi}_{i}, there are three error terms (eiu,eiv,eiz)(\mathbf{e}^{u}_{i},\mathbf{e}^{v}_{i},\mathbf{e}^{z}_{i}) to regularize the optimization variables with the predicted values from the network. We use this term to constraint the deviation between network estimated object location and the optimized location as follows.

Implementation

We conduct experiments on the challenge KITTI 3D object detection dataset . It is split to 3712 training samples and 3769 validation samples as . Samples are labeled from Easy, Moderate, to Hard according to its condition of truncation, occlusions and bounding box height. Table 1 shows counts of groundtruth pairwise constraints through the proposed pair matching strategy from all the training samples.

We adopt the modified DLA-34 as our backbone. The resolution of the input image is set to 380×1280380\times 1280. The feature map of the backbone output is with a size of 96×320×6496\times 320\times 64. Each of the eleven output branches connects the backbone feature with two additional convolution layers with sizes of 3×3×2563\times 3\times 256 and 1×1×m1\times 1\times m, where mm is the feature channel of the related output branch. Convolution layers connecting output branches maintain the same feature width and height. Thus, the feature size of each output branch is 96×320×m96\times 320\times m.

We train the whole network in an end-to-end manner for 70 epochs with a batchsize of 32 on four GPUs simultaneously. The initial learning rate is 1.25e-4, dropped by multiplying 0.1 both at 45 and 60 epochs. It is trained with Adam optimizer with weight decay as 1e-5. We conduct different data augmentation strategies during training, as random cropping and scaling for 2D detection, and random horizontal flipping for both 3D detection and pairwise constraints prediction.

2 Evaluation

Following , we use 40-point interpolated average precision metric AP40AP_{40} that averaging precision results on 40 recall positions instead of 0. The previous metric AP11AP_{11} of KITTI3D average precision on 11 recall positions, which may trigger bias to some extent. The precision is evaluated at both the bird-eye view 2D box APbvAP_{bv} and the 3D bounding box AP3DAP_{3D} in world space. We report average precision with intersection over union (IoU) using both 0.5 and 0.7 as thresholds.

For the evaluation and ablation study, we show experimental results from three different setups. Baseline is derived from CenterNet with an additional output branch to represent the offset of the 3D projected center to the located keypoint. +σz+σuv+\sigma^{z}+\sigma^{uv} adds two uncertainty prediction branches on Baseline which consists of all the three 2D detection branches and six 3D detection branches as shown in Figure 1. MonoPair is the final proposed method integrating the eleven prediction branches and the pairwise spatial constraint optimization.

Experimental Results

We first show the performance of our proposed MonoPair on KITTI3D validation set for car, compared with other state-of-the-art (SOTA) monocular 3D detectors including MonoDIS , MonoGRNet and M3D-RPN in Table 2. Since MonoGRNet and M3D-RPN have not published their results through AP40AP_{40}, we evaluate the related values through their published detection results or models.

As shown in Table 2, although our baseline is only comparable or a little worse than SOTA detector M3D-RPN, MonoPair outperforms all the other detectors mostly by a large margin, especially for hard samples with augmentations from the uncertainty and the pairwise spatial constraint. Table 3 shows results of our MonoPair on the KITTI3D test set for car. From the KITTI 3D object detection benchmarkhttp://www.cvlibs.net/datasets/kitti/eval_object.php?obj_benchmark=3d, we achieve the highest score for Moderate samples and rank at the first place among those 3D monocular object detectors without using additional information. AP2DAP_{2D} and AOSAOS are metrics for 2D object detection and orientation estimations following the benchmark. Apart from the Easy result of APbvAP_{b}v and AP3DAP_{3D}, our method outperforms M3D-RPN for a large margin, especially for Hard samples. It proves the effects of the proposed pairwise constraint optimization targeting for highly occluded samples.

We show the pedestrian and cyclist detection results on the KITTI test set in Table 4. Because MonoDIS and MonoGRNet do not report their performance on pedestrian and cyclist categories, we only compare our method with M3D-RPN . It presents a significant improvement from our MonoPair. Even though the relatively few training samples of pedestrian and cyclist, the proposed pairwise spatial constraint goes much deeper by utilizing object relationships compared with target-independent detectors.

Besides, compared with those methods relying on time-consuming region proposal network , our one-stage anchor-free detector is more than two times faster on an Nvidia GTX 1080 Ti. It can perform inference in real-time as 57 ms per image, as shown in Table 2.

2 Ablation Study

We conduct two ablation studies for different uncertain terms and the count of pairwise constraints both on KITTI3D validation set through AP40{AP_{40}}. We only show results from Moderate samples here.

For uncertainty study, except the Baseline and +σz+σuv+\sigma^{z}+\sigma^{uv} setups mentioned above, we add σz\sigma^{z} and σuv\sigma^{uv} methods by only predict the depth or projected offset uncertainty based on the Baseline. From Table 5, uncertainties prediction from both depth and offset show considerable development above the baseline, where the improvement from depth is larger. The results match the fact that depth prediction is a much more challenging task and it can benefit more from the uncertainty term. It proves the necessity of imposing uncertainties for 3D object prediction, which is rarely considered by previous detectors.

In terms of the pairwise constraint, we divide the validation set to different parts based on the count of groundtruth pairwise constraints. The Uncert. in Table 6 represents +σz+σuv+\sigma^{z}+\sigma^{uv} for simplicity. By checking both the APbvAP_{bv} and AP3D{AP_{3D}} in Table 6, the third group with 5 to 8 pairs shows higher average precision improvement. A possible explanation is that fewer pairs may not provide enough constraints, and more pairs may increase the complexity of the optimization.

Also, to prove the utilization of using uncertainties to weigh related errors, we tried various strategies for weight matrix designing, for example, giving more confidence for objects closed to the camera or setting the weight matrix as identity. However, none of those strategies showed improvements in the detection performance. On the other hand, the baseline is easily dropped to be worse because of coarse post-optimization. It shows that setting the weight matrix of the proposed spatial constraint optimization is nontrivial. And uncertainties, besides its original function to enhance network training, is naturally a meaningful choice for weights of different error terms.

Conclusions

We proposed a novel post-optimization method for 3D object detection with uncertainty-aware training from a monocular camera. By imposing aleatoric uncertainties into the network and considering spatial relationships for objects, our method has achieved the state-of-the-art performance on KITTI 3D object detection benchmark using a monocular camera without additional information. By exploring the spatial constraints of object pairs, we observed the enormous potential of geometric relationships in object detection, which was rarely considered before. For future work, finding spatial relationships across object categories and innovating pair matching strategies would be exciting next steps.

References