EPro-PnP: Generalized End-to-End Probabilistic
Perspective-n-Points for Monocular
Object Pose Estimation
Abstract
Locating 3D objects from a single RGB image via Perspective-n-Point (PnP) is a long-standing problem in computer vision. Driven by end-to-end deep learning, recent studies suggest interpreting PnP as a differentiable layer, allowing for partial learning of 2D-3D point correspondences by backpropagating the gradients of pose loss. Yet, learning the entire correspondences from scratch is highly challenging, particularly for ambiguous pose solutions, where the globally optimal pose is theoretically non-differentiable w.r.t. the points. In this paper, we propose the EPro-PnP, a probabilistic PnP layer for general end-to-end pose estimation, which outputs a distribution of pose with differentiable probability density on the SE(3) manifold. The 2D-3D coordinates and corresponding weights are treated as intermediate variables learned by minimizing the KL divergence between the predicted and target pose distribution. The underlying principle generalizes previous approaches, and resembles the attention mechanism. EPro-PnP can enhance existing correspondence networks, closing the gap between PnP-based method and the task-specific leaders on the LineMOD 6DoF pose estimation benchmark. Furthermore, EPro-PnP helps to explore new possibilities of network design, as we demonstrate a novel deformable correspondence network with the state-of-the-art pose accuracy on the nuScenes 3D object detection benchmark. Our code is available at https://github.com/tjiiv-cprg/EPro-PnP-v2.
Index Terms:
Pose estimation, imaging geometry, probabilistic deep learning, 3D vision, autonomous vehicles1 Introduction
Estimating the pose (i.e., position and orientation) of 3D objects from a single RGB image is an important problem in computer vision. This field is often subdivided into specific tasks, e.g., 6DoF pose estimation for robot manipulation and 3D object detection for autonomous driving. Although they share the same fundamentals of pose estimation, the different nature of the data leads to biased choice of methods. Top performers [1, 2, 3] on the 3D object detection benchmarks [4, 5] fall into the category of direct 4DoF pose prediction, leveraging the advances in end-to-end deep learning. On the other hand, the 6DoF pose estimation benchmark [6] is largely dominated by geometry-based methods [7, 8], which exploit the provided 3D object models and achieve a stable generalization performance. However, it is quite challenging to bring together the best of both worlds, i.e., training a geometric model to learn the object pose in an end-to-end manner.
There has been recent proposals for an end-to-end framework based on the Perspective-n-Point (PnP) approach [9, 10, 11, 12]. The PnP algorithm itself solves the pose from a set of 3D points in object space and their corresponding 2D projections in image space, leaving the problem of constructing these correspondences. Vanilla correspondence learning [13, 14, 15, 16, 17, 8, 18, 19, 20, 17] leverages the geometric prior to build surrogate loss functions, forcing the network to learn a set of pre-defined correspondences. End-to-end correspondence learning [9, 10, 11, 12] interprets the PnP solver as a differentiable layer and employs pose-driven loss function, so that gradient of the pose error can be backpropagated to the 2D-3D correspondences.
However, existing work on differentiable PnP learns only a portion of the correspondences (either 2D coordinates [12], 3D coordinates [9, 10] or corresponding weights [11]), assuming other components are given a priori. This raises an important question: why not learn the entire set of points and weights altogether in an end-to-end manner? Our intuition is: under such relaxed settings, the PnP problem could better describe pose ambiguity [21, 22], in the cases of symmetric objects [17] or uncertain observations. However, with the presence of ambiguity, the PnP problem has multiple local minima. Existing methods try to differentiate a point estimate of the pose (a single local minima), which is unstable in general, while the global optimum is neither easy to find nor differentiable.
To overcome the above limitations, we propose a generalized end-to-end probabilistic PnP (EPro-PnP) module that enables learning the weighted 2D-3D point correspondences entirely from scratch. The main idea is straightforward: a point estimate of pose is non-differentiable, but the probability density of pose is apparently differentiable, just like categorical classification scores. As shown in Figure 1, we interpret the output of PnP as a probabilistic distribution parameterized by the learnable 2D-3D correspondences. During training, the Kullback-Leibler (KL) divergence between the predicted and target pose distributions is minimized as the loss function, which can be efficiently calculated using the Adaptive Multiple Importance Sampling [23] algorithm.
As a general approach, EPro-PnP inherently unifies existing correspondence learning techniques (Section 3.1). Moreover, just like the attention mechanism [24], the corresponding weights can be trained to automatically focus on important point pairs, allowing the networks to be designed with inspiration from attention-related work [25, 26, 27].
To summarize, our main contributions are as follows:
-
•
We propose the EPro-PnP, a probabilistic PnP layer for general end-to-end pose estimation with learnable 2D-3D correspondences, which can cope with pose ambiguity.
-
•
We demonstrate that EPro-PnP can easily reach top-tier performance for 6DoF pose estimation by simply inserting it into the CDPN [18] framework.
-
•
We demonstrate the flexibility of EPro-PnP by proposing deformable correspondence learning for accurate 3D object detection, where the entire 2D-3D correspondences are learned from scratch.
This extended paper presents new experiments with improved results and rigorous ablation studies. For 6DoF pose estimation on LineMOD, feeding 2D box size to the model has improved uncertainty handling, boosting pose accuracy to outperform RePOSE [7]. New ablation studies reveal each loss’s contribution and show that EPro-PnP can achieve competitive performance even without 3D models (B2 in Table II). For 3D object detection on nuScenes, EPro-PnP with an enhanced network now leads the field of single-frame image-based detectors, and the ablation studies highlight the importance of the Monte Carlo pose loss in handling ambiguous poses. Furthermore, we have also expanded our discussion on the derivative regularization loss.
2 Related Work
2.1 Geometry-Based Object Pose Estimation
In general, geometry-based methods exploit the points, edges or other types of representation that are subject to the projection constraints under the perspective camera. Then, the pose can be solved by optimization. A large body of work utilizes point representation, which can be categorized into sparse keypoints and dense correspondences. BB8 [15] and RTM3D [19] locate the corners of the 3D bounding box as keypoints, while PVNet [13] defines the keypoints by farthest point sampling and Deep MANTA [20] by handcrafted templates. On the other hand, dense correspondence methods [17, 18, 8, 28, 16] predict pixel-wise 3D coordinates within a cropped 2D region. Most existing geometry-based methods follow a two-stage strategy, where the intermediate representations (i.e., 2D-3D correspondences) are learned with a surrogate loss function, which is sub-optimal compared to end-to-end learning.
2.2 End-to-End Correspondence Learning
To mitigate the limitation of surrogate correspondence learning, end-to-end approaches have been proposed to backpropagate the gradient from pose to intermediate representation. Using implicit differentiation w.r.t. the optimal pose or its approximations, Brachmann and Rother [10] propose a dense correspondence network where 3D points are learnable, BPnP [12] predicts 2D keypoint locations, and BlindPnP [11] learns the corresponding weight matrix given a set of unordered 2D/3D points. The above methods are all coupled with surrogate regularization loss, otherwise convergence is not guaranteed due to numerical instability [10] and the non-differentiable nature of the optimal pose. Under the probabilistic framework, these methods can be regarded as a Laplace approximation approach (Section 3.1).
2.3 Probabilistic Deep Learning
Probabilistic methods account for uncertainty in the model and the data, known respectively as epistemic and aleatoric uncertainty [29]. The latter involves interpreting the prediction as learnable probabilistic distributions. Discrete categorical distribution via Softmax has been widely adopted as a smooth approximation of one-hot for end-to-end classification. This inspired works such as DSAC [9], a smooth RANSAC with a finite hypothesis pool. Meanwhile, tractable parametric distributions (e.g., normal distribution) are often used in predicting continuous variables [30, 31, 29, 32, 33, 28], and mixture distributions can be employed to further capture ambiguity [34, 35, 36], e.g., ambiguous 6DoF pose [37]. In this paper, we propose yet a unique contribution: backpropagating a complicated continuous distribution derived from a nested optimization layer (the PnP layer) approximated by importance sampling, essentially making it a continuous counterpart of Softmax.
3 Generalized End-to-End Probabilistic PnP
3.1 Overview
Given an object proposal, our goal is to predict a set of corresponding points, with 3D object coordinates , 2D image coordinates , and 2D weights , from which a weighted PnP problem can be formulated to estimate the object pose relative to the camera.
The essence of a PnP layer is searching for an optimal pose (expanded as rotation matrix and translation vector ) that minimizes the cumulative squared weighted reprojection error:
(1) |
where is the projection function with camera intrinsics involved, stands for element-wise product, and compactly denotes the weighted reprojection error.
Eq. (1) formulates a non-linear least squares problem that may have non-unique solutions, i.e., pose ambiguity [21, 22]. Previous work [10, 12, 11] only backpropagates through a local solution , which is inherently unstable and non-differentiable. To construct a differentiable alternative for end-to-end learning, we model the PnP output as a distribution of pose, which guarantees differentiable probability density. The cumulative error is considered to be the negative logarithm of the likelihood function defined as:
(2) |
With an additional prior pose distribution , we can derive the posterior pose via the Bayes theorem. Using an uniform prior in the domain , the posterior density is simplified to the normalized likelihood:
(3) |
Eq. (3) can be interpreted as a continuous counterpart of categorical Softmax.
3.1.1 KL Loss Function
During training, given a target pose distribution with probability density , the KL divergence is minimized as training loss. Intuitively, pose ambiguity can be captured by the multiple modes of , and convergence is ensured such that wrong modes are suppressed by the loss function. Substituting Eq. (3), the KL divergence loss can be re-written as follows:
(4) |
In practice, we drop the constant relevant to the target distribution so that it is effectively a cross-entropy loss. In addition, we empirically find it effective to set a narrow (Dirac-like) target distribution centered at the ground truth , yielding the simplified loss (after substituting Eq. (2)):
(5) |
The only remaining problem is the integration in the second term, which is elaborated in Section 3.2.
3.1.2 Comparison to Reprojection-Based Method
The two terms in Eq. (5) are concerned with the reprojection errors at target and predicted pose respectively. The former is often used as a surrogate loss in previous work [12, 10, 28]. However, the first term alone cannot handle learning all 2D-3D points without imposing strict regularization, as the minimization could simply collapse all the 2D-3D points. The second term originates from the normalization factor in Eq. (3), and is crucial to a discriminative loss function, as shown in Figure 2.
3.1.3 Comparison to Implicit Differentiation Method
Existing work on end-to-end PnP [12, 11] derives a single solution of a particular solver via implicit function theorem [38], assuming . In the probabilistic framework, this is essentially the Laplace method that approximates the posterior by , where both and can be estimated by the PnP solver with analytical derivatives [28]. If is simplified to be isotropic, the approximated KL divergence can be simplified into the L2 loss used in [11]. However, the Laplace approximation is inaccurate for non-normal posteriors with ambiguity, therefore does not guarantee global convergence. Besides, implicit differentiation itself may be prone to numerical instability [10].
3.2 Monte Carlo Pose Loss
In this section, we introduce a GPU-friendly efficient Monte Carlo approach to the integration in the proposed loss function, based on the Adaptive Multiple Importance Sampling (AMIS) algorithm [23].
Considering to be the probability density function of a proposal distribution that approximates the shape of the integrand , and to be one of the samples drawn from , the estimation of the second term in Eq. (5) is thus:
(6) |
where compactly denotes the importance weight at . Eq. (6) gives the vanilla importance sampling, where the choice of proposal strongly affects the numerical stability. The AMIS algorithm is a better alternative as it iteratively adapts the proposal to the integrand.
In brief, AMIS utilizes the sampled importance weights from past iterations to estimate the new proposal. Then, all previous samples are re-weighted as being homogeneously sampled from a mixture of the overall sum of proposals. [23] Initial proposal can be determined by the mode and covariance of the predicted pose distribution (see supplementary for details). A pseudo-code is given below.
In this paper, we empirically set the AMIS iteration count to 4, and the number of samples per iteration to 128 for 6DoF pose and 32 for 4DoF pose (1D yaw-only orientation). These hyperparameters can be adjusted to balance computation and accuracy.
3.2.1 Choice of Proposal Distribution
We use separate proposal distributions for position and orientation, as the orientation space is non-Euclidean. For position, we adopt the 3DoF multivariate t-distribution. For 1D yaw-only orientation, we use a mixture of von Mises and uniform distribution. For 3D orientation represented by unit quaternion, the angular central Gaussian distribution [39] is adopted.
3.3 Backpropagation
Although backpropagation can be simply implemented with automatic differentiation packages, here we analyze the gradients of the loss function for an intuitive understanding of the learning process. In general, the gradients of the loss function defined in Eq. (5) is:
(7) |
where the first term is the gradient of reprojection errors at target pose, and the second term is the expected gradient of reprojection errors over predicted pose distribution, which is approximated by backpropagating the importance weights in the Monte Carlo pose loss.
3.3.1 Balancing Uncertainty and Discrimination
Consider the negative gradient w.r.t. the corresponding weights :
(8) |
where (unweighted reprojection error), and stands for element-wise square. The first bracketed term with negative sign indicates that correspondences with large reprojection error (hence high uncertainty) shall be weighted less. The second term is relevant to the variance of reprojection error over the predicted pose. The positive sign indicates that correspondences sensitive to pose variation should be weighted more, because they provide stronger pose discrimination. The final gradient is thus a balance between the uncertainty and discrimination, as shown in Figure 3. Existing work [28, 13] on learning uncertainty-aware correspondences only considers the former, hence lacking the discriminative ability.
3.4 Limitations and Derivative Regularization Loss
In practice, we observe that the KL divergence loss has two limitations:
-
•
While the KL divergence is a good metric for the probabilistic distribution, existing evaluation protocols are all based on the point estimate of pose . Therefore, for inference it is still required to locate a mode of the posterior by solving the PnP problem in Eq. (1), which could be sub-optimal if trained solely with the KL loss.
-
•
The 2D-3D correspondences are underdetermined if we only impose the KL loss when training the network. Learning these entangled elements could be difficult if the network architecture is not designed carefully with preferable inductive bias.
The above limitations can be mitigated by an additional regularization loss on that backpropagates through the Gauss-Newton (GN) least squares solver or its variants [7]. We call it the derivative regularization loss, since GN is a derivative-based optimizer, and the loss therefore acts on the derivatives of the log-density to direct the GN increment towards the true pose .
To employ the regularization during training, a detached solution is obtained first. Then, at , a final GN increment is evaluated (which ideally equals 0 if has already converged to the local optimum):
(9) |
where is the flattened weighted reprojection errors of all points, is the Jacobian matrix, equals the gradient of the negative log-likelihood (NLL) w.r.t. object pose, i.e., , and is an approximation of the Hessian matrix . We therefore design the regularization loss as follows:
(10) |
where is a distance metric for pose. We adopt smooth L1 for position and cosine similarity for orientation (see supplementary materials for details). Note that the gradient is only backpropagated through , which is analytically differentiable w.r.t. the 2D-3D correspondences.
This loss not only addresses the first limitation by moving towards , but also partially disentangles the 2D-3D correspondences. To analyze the effect of the loss on the correspondences, we consider a local approximation of Eq. (10), assuming equal weights for position and orientation:
(11) |
Note that is also the pseudo inverse of the matrix , which can be denoted by for brevity. Then, taking the first-order approximation , the loss can be approximated into:
(12) |
This indicates that the derivative regularization loss is analogous to the reprojection-based surrogate loss (Section 3.1.2). Although the extra weighting matrix makes the individual elements in the reprojection vector underdetermined, over multiple samples and mini-batches there remains a tendency of independently minimizing each of the elements, i.e., minimizing the reprojection error of each correspondence. Thus, it helps to overcome the potential training difficulties associated with the KL loss.
The regularization loss can also serve as an independent objective for training pose estimators, akin to RePOSE [7]. However, since we observe that this objective alone is not effective in addressing pose ambiguity, it is treated as a secondary regularization in this study.
4 Implementation Details
4.1 Dynamic KL Loss Weight
Following [28], we compute a dynamic loss weight for so that the magnitude of its gradients is consistent regardless of the entropy of the distribution. This is implemented by computing the exponential moving average (EMA) of the 1-norm of the sum of weights , and using the reciprocal of the EMA value as the dynamic loss weight for . Intuitively, this cancels out the effect of the magnitude of on the loss gradients w.r.t. and .
4.2 Adaptive Huber Kernel
For the PnP formulation in Eq. (1), the plain L2 reprojection errors are sensitive to outliers, which limits the model’s expressiveness in representing multi-modal distributions that characterizes ambiguity. Therefore, we robustify the reprojection errors using the Huber kernel , yielding an alternative formulation:
(13) |
The Huber kernel with threshold is defined as:
(14) |
To robustify the weighted reprojection errors of various scales, we adopt an adaptive threshold defined as a function of the weights and 2D coordinates :
(15) |
with the relative threshold as a hyperparameter, and the mean vectors .
Accordingly, the reprojection errors and Jacobian matrix in Eq. (9) have to be rescaled (see supplementary).
4.3 Initialization
Since the LM solver only finds a local solution, initialization plays a determinant role in dealing with ambiguity. We implement a random sampling algorithm analogous to RANSAC, to search for the global optimum efficiently.
Given the -point correspondence set , we generate subsets consisting of corresponding points each (), by repeatedly sub-sampling indices without replacement from a multinomial distribution, whose probability mass function is defined by the corresponding weights:
(16) |
From each subset, a pose hypothesis can be solved via the LM algorithm within very few iterations (e.g. 3 iterations). This is implemented as a batch operation on GPU, and is rather efficient for small subsets. We take the hypothesis with maximum log-likelihood as the initial point, starting from which subsequent LM iterations are computed on the full set .
4.3.1 Training Mode Initialization
During training, the LM PnP solver is utilized for estimating the location and concentration of the initial proposal distribution in the AMIS algorithm. The location is very important to the stability of Monte Carlo training. If the LM solver fails to find the global optimum, and the location of the local optimum is far from the true pose , the balance between the two opposite signed terms in Eq. (5) may be broken, leading to exploding gradient in the worst case scenario. To avoid such problem, we adopt a simple initialization trick: we compare the log-likelihood of the ground truth and the selected hypothesis, and then keep the one with higher likelihood as the initial state of the LM solver.
5 6DoF Pose Estimation based on CDPN
To demonstrate that EPro-PnP can be applied to off-the-shelf 2D-3D correspondence networks, experiments have been conducted on CDPN [18], a dense correspondence network for 6DoF pose estimation.
5.1 Network Architecture
The original CDPN feeds cropped image regions within the detected 2D boxes into the pose estimation network, to which two decoupled heads are appended for rotation and translation respectively. The rotation head is PnP-based while the translation head uses explicit center and depth regression. This paper discards the translation head to focus entirely on PnP, and modifies only the last layer of the rotation head for strict comparison to the baseline.
As shown in Fig. 4, apart from the standard 3D coordinate map, the network predicts a 2-channel weight map (originally it is a single channel segmentation mask). We find it necessary to predict a global scale separately, and apply it to the normalized weights that satisfies . Intuitively, the global scale controls the entropy of the pose distribution as it scales the entire log-likelihood, while the normalized weights determines the relative importance of each correspondence. This helps to overcome the entangling effect of the KL loss mentioned in Section 3.4. Inspired by the attention mechanism [24], the normalized weights are activated via spatial Softmax, focusing on important regions in the image. The global scale is usually inversely proportional to the 2D size of the object due to the uncertainty in reprojection, and is hard-coded as such in this network.
The original CDPN imposes masked coordinate regression loss[18] to learn the dense correspondences, using the ground truth object 3D models to render the target masks and 3D coordinate maps. With EPro-PnP, however, this extra geometry supervision is optional, as we demonstrate that the entire network can be trained solely by the KL loss and/or the derivative regularization loss . To reduce the Monte Carlo overhead, 512 points are randomly sampled from the 64×64 dense points to compute .
ID | Method | ADD(-S) | Mean | ||
0.02d | 0.05d | 0.1d | |||
A0 | CDPN-Full [18] | 29.10 | 69.50 | 91.03 | 63.21 |
A1 | CDPN w/o trans. head | 15.93 | 46.79 | 74.54 | 45.75 |
A2 | A1 → Batch=32, LM solver | 21.17 | 55.00 | 79.96 | 52.04 |
5.2 Dataset and Metrics
As in CDPN, we use the LineMOD [6] 6DoF pose estimation dataset to conduct our experiments. The dataset consists of 13 sequences, each containing about 1.2K images annotated with 6DoF poses of a single object. Following [36], the images are split into the training and testing sets, with about 200 images per object for training. For data augmentation, we use the same synthetic data as in CDPN [18].
We use two common metrics for evaluation: ADD(-S) and . The ADD measures whether the average deviation of the transformed model points is less than a certain fraction of the object’s diameter (e.g., ADD-0.1d). For symmetric objects, ADD-S computes the average distance to the closest model point. measures the accuracy of pose based on angular/positional error thresholds. All metrics are presented as percentages.
Despite that some objects in the dataset are nearly rotational symmetric, we observe that our model has no trouble identifying their exact orientations. Therefore, the presented results shall be closer to the scenario without pose ambiguity.
5.3 Baseline
For strict comparison, general settings are kept the same as in CDPN [18] (with ResNet-34 [40] as backbone). As shown in Table I, the original CDPN-Full (A0) trains the network in 3 stages totaling 480 epochs using RMSprop. With the translation head removed, we only train the rotation head in a single stage of 160 epochs (A1), which greatly impacts the pose accuracy (45.75 vs. 63.21). Additionally, we improve the baseline by using the LM solver with Huber kernel at test time, and increase the batch size to 32 for less training wall time (A2). Instead of using the advanced initialization technique in Section 4.3, we adopt the simple EPnP [41] initialization without RANSAC.
5.4 Main Results and Discussions
As shown in Table II, we conduct ablation studies to reveal the contributions of the Monte Carlo KL loss , the derivative regularization loss , the original coordinate regression loss in CDPN [18], and initializing the model with pretrained weights from A1.
5.4.1 KL Loss vs. Coordinate Regression
Training the model from scratch with the KL loss alone (B0) significantly outperforms the baseline model (A2) trained with the coordinate regression loss (61.87 vs. 52.04), despite the lack of geometry supervision from the ground truth object 3D models.
5.4.2 KL Loss and Derivative Regularization
Both the KL loss (B0) and the derivative regularization loss (B1) performs well independently on this benchmark. Because pose ambiguity is not noticeable in LineMOD dataset, the solver-based derivative regularization loss performs better than the KL loss (63.15 vs. 61.87). Nevertheless, the best possible pose accuracy without knowing the object geometry can be achieved when combining both loss functions together (B2), even outperforming CDPN-Full (A0) by a clear margin (67.36 vs. 63.21).
5.4.3 With Knowledge of the Object 3D Models
On top of B2, one can further impose the coordinate regression loss (B4) with target 3D coordinates rendered from the object 3D models, further improving the pose accuracy. Yet a better approach to exploiting the 3D models is to pretrain the network in the traditional way (A1) and then finetune it with EPro-PnP (B5), yielding significantly better results (73.87). This training scheme partially benefits from more training epochs (2×160 in total). Furthermore, kee** the coordinate regression loss during finetuning (B6) slightly improves the score (73.95 vs. 73.87).
We also observe that both the derivative regularization loss (B2) and the coordinate regression loss (B3) improve the results of the bare KL loss setup (B0) to similar extends (67.36 vs. 67.74), as they are both disentangled objectives.
5.5 Comparison to Implicit Differentiation and Reprojection-Based Loss
As shown in Table III, when the coordinate regression loss is removed, i.e., object 3D models are unavailable, both implicit differentiation and reprojection loss fail to learn the pose properly. Yet EPro-PnP manages to learn the 3D coordinates and weights from scratch. This validates that EPro-PnP can be used as a general pose estimator without relying on geometric prior.
ID | Init. | ADD(-S) | Mean | |||||
0.02d | 0.05d | 0.1d | ||||||
B0 | ✓ | 28.48 | 67.20 | 89.93 | 61.87 | |||
B1 | ✓ | 25.86 | 70.90 | 92.68 | 63.15 | |||
B2 | ✓ | ✓ | 34.08 | 74.16 | 93.85 | 67.36 | ||
B3 | ✓ | ✓ | 34.40 | 75.00 | 93.83 | 67.74 | ||
B4 | ✓ | ✓ | ✓ | 36.22 | 75.97 | 94.64 | 68.94 | |
B5 | ✓ | ✓ | ✓ | 43.34 | 82.13 | 96.14 | 73.87 | |
B6 | ✓ | ✓ | ✓ | ✓ | 43.77 | 81.73 | 96.36 | 73.95 |
Method | Type | ADD(-S) | ||
0.02d | 0.05d | 0.1d | ||
CDPN [18] | PnP + Explicit depth | - | - | 89.86 |
HybridPose [14] | Hybrid constraints | - | - | 91.3 |
GDRNet* [43] | PnP + Explicit depth | 35.6 | 76.0 | 93.6 |
DPOD [8] | PnP + Explicit refiner | - | - | 95.15 |
PVNet-RePOSE [7] | PnP + Implicit refiner | - | - | 96.1 |
PVNet-RNNPose [42] | PnP + Implicit refiner | 50.39 | 85.56 | 97.37 |
Ours | PnP | 43.77 | 81.73 | 96.36 |
5.6 Comparison to the State of the Art
As shown in Table IV, although we base EPro-PnP on the older baseline CDPN [18], the results are better than some of the more advanced methods, e.g., the pose refiner RePOSE [7] that adds extra overhead to the PnP-based initial estimator PVNet [13]. Among all these entries, EPro-PnP is the most straightforward as it simply solves the PnP problem itself, without refinement network [7, 8, 42], explicit depth prediction [18, 43], or multiple representations [14].
Moreover, removing the translation head (depth prediction) from the original CDPN-Full results in far fewer parameters in our model (from 113M to 27M) , and the overall inference speed is more than twice as fast as CDPN-Full (including dataloading, measured at a batch size of 32), even though we introduce the iterative LM solver. Furthermore, faster inference is possible if the number of points is reduced to an optimal level.
5.7 Visualizations
As illustrated in Figure 5, the weight maps predicted by the model trained with the KL loss (B0) tend to be more focused on important parts of the objects (e.g., the head and handle of the watering can), while those with the derivative regularization loss (B1) are more evenly spread out. Combining the two loss functions (B2) leads to more reasonable weighting, and more details in the object geometry (represented by ). With additional geometry pretraining and supervision (B6), the model outputs sharper correspondence maps, which contribute to higher pose accuracy and lower entropy of the probabilistic pose.
6 3D Object Detection based on Deformable Correspondence Network
To demonstrate that EPro-PnP can learn the entire set of 2D-3D correspondences from scratch, and the possibility of designing novel correspondence networks capable of handling pose ambiguity, we propose a novel deformable correspondence network for 3D object detection. The network owes its name to the Deformable DETR [27], a work that inspired our model architecture.
6.1 Network Architecture
As shown in Figure 6, the deformable correspondence network is an extension of the FCOS3D [44] framework. The original FCOS3D is a one-stage detector that directly regresses the center offset, depth, and yaw orientation of multiple objects for 4DoF pose estimation. In our adaptation, the outputs of the multi-level FCOS head [45] are modified to generate object queries instead of directly predicting the pose. Inspired by Deformable DETR [27], the appearance and position of a query is disentangled into the object embedding vector and the reference point. Moreover, to better distinguish objects of different classes, we learn a set of class embedding vectors, one of which will be selected according to the object label to be aggregated into the object embedding vector via addition (not shown in Figure 6 for brevity).
With the object queries, a multi-head deformable attention layer [27] is adopted to sample the key-value pairs from interpolated dense feature map, with the value projected into point-wise features (point feat), and meanwhile aggregated into the object-level features (obj feat).
The point features are passed into a subnet that predicts the 3D points and corresponding weights (normalized by Softmax). Following MonoRUn [28], the 3D points are set in the normalized object coordinate (NOC) space to handle categorical objects of various sizes.
The object features are responsible for predicting the object-level properties: (a) the 3D score (i.e., 3D localization confidence), (b) the global weight scale, (c) the 3D box size for recovering the absolute scale of the 3D points, and (d) other optional properties (velocity, attribute) required by the nuScenes benchmark [4].
6.1.1 Implementation Details
We adopt the same detector architecture as in FCOS3D [44], with ResNet-101-DCN [46] as backbone. The deformable correspondence head predicts pairs of 2D-3D points. The network is trained for 12 epochs by the AdamW [47] optimizer, with a batch size of 12 images across 2 GPUs on the nuScenes dataset [4].
6.2 Loss Functions
6.2.1 Correspondence Loss
The deformable 2D-3D correspondences can be learned solely with the KL divergence loss , or in conjunction with the regularization loss .
6.2.2 Auxiliary Correspondence Loss (Optional)
Inspired by the dense correspondence network MonoRUn [28], we regularize the dense features by appending a small auxiliary network that predicts the multi-head dense 3D coordinates and weights corresponding to densely-sampled 2D points within the ground truth (using RoI Align [48]). This allows us to employ the uncertainty-aware reprojection loss [28] without directly regularizing the deformable correspondences. Furthermore, we can convert the LiDAR scan of objects into sparse 3D object coordinate maps, so that the classical coordinate regression loss can be imposed on the auxiliary branch as well. Both of the loss functions are implemented as the NLL of Gaussian mixtures to deal with ambiguity (see supplementary for details).
6.2.3 Other Loss Functions
Loss functions on the FCOS head include:
-
•
Basic detector loss, including focal loss [49] for classification and cross entropy loss for centerness.
-
•
A smooth L1 loss for regressing the 2D reference points, with the target defined as the center of the visible region of the objects.
- •
Loss functions for the object-level predictions include:
-
•
A cross entropy loss for the 3D score.
-
•
A smooth L1 loss for regressing the 3D box size.
-
•
A smooth L1 loss for regressing the velocity and a cross entropy loss for attribute classification.
Additionally, inspired by DD3D [2], we further exploit the available LiDAR data to build an auxiliary depth supervision. By projecting the LiDAR points to the camera frame, we extract the point-wise features from the interpolated dense feature map, which are then fed into a small 2-layer MLP to predict the scene depth. Same as the auxiliary correspondence loss functions in Section 6.2.2, the depth loss is implemented as the NLL of Gaussian mixtures, which allows modeling discontinuities around sharp edges [52].
6.3 Dataset and Metrics
We evaluate the deformable correspondence network on the nuScenes 3D object detection benchmark [4], which provides a large scale of data collected in 1000 scenes. Each scene contains 40 keyframes, annotated with a total of 1.4M 3D bounding boxes from 10 categories. Each keyframe includes 6 RGB images collected from surrounding cameras. The data is split into 700/150/150 scenes for training/validation/testing. The official benchmark evaluates the average precision with true positives judged by 2D center error on the ground plane. The mAP metric is computed by averaging over the thresholds of 0.5, 1, 2, 4 meters. Besides, there are 5 true positive metrics: Average Translation Error (ATE), Average Scale Error (ASE), Average Orientation Error (AOE), Average Velocity Error (AVE) and Average Attribute Error (AAE). Finally, there is a nuScenes detection score (NDS) computed as a weighted average of the above metrics.
6.4 Main Results and Discussions
6.4.1 Comparison Among Correspondence Loss Functions
As shown in Table V, the model trained with KL loss alone (C0) is significantly stronger than the model trained with the derivative regularization loss alone (C1) in all the metrics of concern, especially the orientation error (0.332 vs. 0.607). This is due to the presence of orientation ambiguity in the nuScenes dataset. Even if all the auxiliary loss functions (C2) are applied, the derivative regularization loss still fail to reach comparable performance to the Monte Carlo KL loss. Adding up all the loss functions (C3), the results can be boosted even further.
ID | Aux. loss | NDS↑ | mAP↑ | mATE↓ | mAOE↓ | |||
C0 | ✓ | 0.447 | 0.380 | 0.656 | 0.332 | |||
C1 | ✓ | 0.408 | 0.363 | 0.683 | 0.607 | |||
C2 | ✓ | ✓ | ✓ | 0.429 | 0.363 | 0.691 | 0.397 | |
C3 | ✓ | ✓ | ✓ | ✓ | 0.463 | 0.392 | 0.626 | 0.282 |
Method | Backbone | NDS↑ | mAP↑ | mATE↓ | mASE↓ | mAOE↓ | mAVE↓ | mAAE↓ |
FCOS3D §† [44] | R101 | 0.428 | 0.358 | 0.690 | 0.249 | 0.452 | 1.434 | 0.124 |
PGD § [1] | R101 | 0.448 | 0.386 | 0.626 | 0.245 | 0.451 | 1.509 | 0.127 |
PETR [53] | R101 | 0.455 | 0.391 | 0.647 | 0.251 | 0.433 | 0.933 | 0.143 |
BEVFormer [54] | R101 | 0.462 | 0.409 | 0.650 | 0.261 | 0.439 | 0.925 | 0.147 |
PolarFormer [55] | R101 | 0.470 | 0.415 | 0.657 | 0.263 | 0.405 | 0.911 | 0.139 |
PETR [53] | Swin-B | 0.483 | 0.445 | 0.627 | 0.249 | 0.449 | 0.927 | 0.141 |
Ours | R101 | 0.481 | 0.409 | 0.559 | 0.239 | 0.325 | 1.090 | 0.115 |
Ours § | R101 | 0.490 | 0.423 | 0.547 | 0.236 | 0.302 | 1.071 | 0.123 |
6.4.2 Comparison to the State of the Art
Results on the nuScenes test set [4] are shown in Table VI. At the time of submitting the manuscript (Jan 2023), EPro-PnP is the No. 1 single-frame monocular 3D object detector without extra data, according to the official nuScenes detection leaderboard. Among the models using ResNet-101 as backbones, EPro-PnP outperforms PolarFormer [55] by a clear margin (NDS 0.481 vs. 0.470), despite basing the deformable correspondence network on the older FCOS detector. With test-time flip augmentation (following FCOS3D [44]), our model even outperforms PGD [1] with the bulky Swin-B [56] backbone.
Since EPro-PnP is targeted at improving pose accuracy, it is not surprising to see that our model obtains exceptional results regarding the mATE and mAOE metrics, outperforming PolarFormer by a wide margin (mATE 0.559 vs. 0.657, mAOE 0.325 vs. 0.405).
It is worth noting that, EPro-PnP is currently the only method among the entries in Table VI that utilizes geometric pose reasoning, which is not a popular choice because previous non-end-to-end geometric methods usually fall behind when trained on large-scale real-life data.
6.5 Visualizations
An example of the monocular detection result is shown in Figure 7. We observe that the red 2D points (indicating greater in the X axis) are usually spread right over the objects, which mainly determines the orientation, while the green 2D points (indicating greater in the Y axis) are off the top and bottom of the objects, which determines the position (mainly the depth). It seems that the network learns to associate object depth to the height of the object’s projection, since the height invariant to 1D orientation in the ground plane.
6.6 Inference Time
The average inference time per frame (comprising a batch of 6 surrounding 1600×672 images, without TTA) is shown in Table VII, measured on RTX 3090 GPU and Core i9-10920X CPU. On average, the batch PnP solver takes 26 ms/46 ms processing 655.3 objects per frame, before non-maximum suppression (NMS).
PyTorch | Backbone & FPN | Heads | PnP | Total | |
FCOS |
Deform |
||||
v1.8.1+cu111 |
0.194 |
0.074 |
0.029 |
0.026 |
0.328 |
v1.10.1+cu113 |
0.173 |
0.056 |
0.025 |
0.046 |
0.304 |
7 Limitations
Training the network with the Monte Carlo pose loss is inevitably slower than the baseline. With the batch size of 32 on a GTX 1080 Ti GPU, training the CDPN (without translation head) takes 143 seconds per epoch with the original coordinate regression loss, and 241 seconds per epoch with the Monte Carlo pose loss, which is about 70% longer time. However, the training time can be controlled by adjusting the number of Monte Carlo samples or the number of 2D-3D corresponding points.
Although the underlying principles are theoretically generalizable to other learning models with nested optimization layer, known as declarative networks [38], the Monte Carlo pose loss would become impractical with the growth of dimensionality.
While EPro-PnP seems to be a universal approach to end-to-end geometric pose estimation, it should be noted that the design of 2D-3D correspondence network still plays a major role in the model. For example, simply removing the 2D box size from Figure 4 would result in a notable decrease in pose accuracy. Future work may explore the feature-metric correspondence in [7, 42, 58] as a more expressive alternative to plain Euclidean reprojection error.
8 Conclusion
This paper proposes the EPro-PnP, which translates the non-differentiable PnP operation into a differentiable probabilistic layer, empowering end-to-end 2D-3D correspondence learning of unprecedented flexibility. The connections to previous work [28, 12, 11, 10, 7] have been thoroughly discussed with theoretical and experimental proofs, revealing the contributions of the Monte Carlo KL loss and the derivative regularization loss. For application, EPro-PnP can be simply integrated into existing PnP-based networks, or inspire novel solutions such as the deformable correspondence network.
Acknowledgments
This project was supported by the National Natural Science Foundation of China [No. 52002285], the Shanghai Science and Technology Commission [No. 21ZR1467400], the original research project of Tongji University [No. 22120220593], and the National Key R&D Program of China [No. 2021YFB2501104]. Part of the work was done when H. Chen was interning at Alibaba Group, supported by the Alibaba Research Intern Program.
References
- [1] T. Wang, X. Zhu, J. Pang, and D. Lin, “Probabilistic and geometric depth: Detecting objects in perspective,” in Conference on Robot Learning (CoRL), 2021.
- [2] D. Park, R. Ambrus, V. Guizilini, J. Li, and A. Gaidon, “Is pseudo-lidar needed for monocular 3d object detection?” in ICCV, 2021.
- [3] Y. Wang, V. Guizilini, T. Zhang, Y. Wang, H. Zhao, and J. Solomon, “Detr3d: 3d object detection from multi-view images via 3d-to-2d queries,” in Conference on Robot Learning (CoRL), 2021.
- [4] H. Caesar, V. Bankiti, A. H. Lang, S. Vora, V. E. Liong, Q. Xu, A. Krishnan, Y. Pan, G. Baldan, and O. Beijbom, “nuscenes: A multimodal dataset for autonomous driving,” in CVPR, 2020.
- [5] A. Geiger, P. Lenz, and R. Urtasun, “Are we ready for autonomous driving? the kitti vision benchmark suite,” in CVPR, 2012.
- [6] S. Hinterstoisser, S. Holzer, C. Cagniart, S. Ilic, K. Konolige, N. Navab, and V. Lepetit, “Multimodal templates for real-time detection of texture-less objects in heavily cluttered scenes,” in ICCV, 2011.
- [7] S. Iwase, X. Liu, R. Khirodkar, R. Yokota, and K. M. Kitani, “Repose: Fast 6d object pose refinement via deep texture rendering,” in ICCV, 2021.
- [8] S. Zakharov, I. Shugurov, and S. Ilic, “Dpod: 6d pose object detector and refiner,” in ICCV, 2019.
- [9] E. Brachmann, A. Krull, S. Nowozin, J. Shotton, F. Michel, S. Gumhold, and C. Rother, “Dsac - differentiable ransac for camera localization,” in CVPR, 2017.
- [10] E. Brachmann and C. Rother, “Learning less is more - 6d camera localization via 3d surface regression,” in CVPR, 2018.
- [11] D. Campbell, L. Liu, and S. Gould, “Solving the blind perspective-n-point problem end-to-end with robust differentiable geometric optimization,” in ECCV, 2020.
- [12] B. Chen, A. Parra, J. Cao, N. Li, and T.-J. Chin, “End-to-end learnable geometric vision by backpropagating pnp optimization,” in CVPR, 2020.
- [13] S. Peng, Y. Liu, Q. Huang, X. Zhou, and H. Bao, “Pvnet: Pixel-wise voting network for 6dof pose estimation,” in CVPR, 2019.
- [14] C. Song, J. Song, and Q. Huang, “Hybridpose: 6d object pose estimation under hybrid representations,” in CVPR, 2020.
- [15] M. Rad and V. Lepetit, “BB8: A scalable, accurate, robust to partial occlusion method for predicting the 3d poses of challenging objects without using depth,” in ICCV, 2017.
- [16] H. Wang, S. Sridhar, J. Huang, J. Valentin, S. Song, and L. J. Guibas, “Normalized object coordinate space for category-level 6d object pose and size estimation,” in CVPR, 2019.
- [17] K. Park, T. Patten, and M. Vincze, “Pix2pose: Pixel-wise coordinate regression of objects for 6d pose estimation,” in ICCV, 2019.
- [18] Z. Li, G. Wang, and X. Ji, “Cdpn: Coordinates-based disentangled pose network for real-time rgb-based 6-dof object pose estimation,” in ICCV, 2019.
- [19] P. Li, H. Zhao, P. Liu, and F. Cao, “Rtm3d: Real-time monocular 3d detection from object keypoints for autonomous driving,” in ECCV, 2020.
- [20] F. Chabot, M. Chaouch, J. Rabarisoa, C. Teulière, and T. Chateau, “Deep manta: A coarse-to-fine many-task network for joint 2d and 3d vehicle analysis from monocular image,” in CVPR, 2017.
- [21] F. Manhardt, D. M. Arroyo, C. Rupprecht, B. Busam, N. Navab, and F. Tombari, “Explaining the ambiguity of object detection and 6d pose from visual data,” in ICCV, 2019.
- [22] G. Schweighofer and A. Pinz, “Robust pose estimation from a planar target,” IEEE TPAMI, vol. 28, no. 12, pp. 2024–2030, 2006.
- [23] J.-M. Cornuet, J.-M. Marin, A. Mira, and C. P. Robert, “Adaptive multiple importance sampling,” Scandinavian Journal of Statistics, vol. 39, no. 4, p. 798–812, 2012.
- [24] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin, “Attention is all you need,” in NIPS, 2017.
- [25] N. Carion, F. Massa, G. Synnaeve, N. Usunier, A. Kirillov, and S. Zagoruyko, “End-to-end object detection with transformers,” in ECCV, 2020.
- [26] X. Wang, R. Girshick, A. Gupta, and K. He, “Non-local neural networks,” in CVPR, 2018.
- [27] X. Zhu, W. Su, L. Lu, B. Li, X. Wang, and J. Dai, “Deformable detr: Deformable transformers for end-to-end object detection,” in ICLR, 2021.
- [28] H. Chen, Y. Huang, W. Tian, Z. Gao, and L. Xiong, “Monorun: Monocular 3d object detection by reconstruction and uncertainty propagation,” in CVPR, 2021.
- [29] A. Kendall and Y. Gal, “What uncertainties do we need in bayesian deep learning for computer vision?” in NIPS, 2017.
- [30] Y. He, C. Zhu, J. Wang, M. Savvides, and X. Zhang, “Bounding box regression with uncertainty for accurate object detection,” in CVPR, 2019.
- [31] S. Wu, C. Rupprecht, and A. Vedaldi, “Unsupervised learning of probably symmetric deformable 3d objects from images in the wild,” in CVPR, 2020.
- [32] D. P. Kingma and M. Welling, “Auto-encoding variational bayes,” in ICLR, 2014.
- [33] I. Gilitschenski, R. Sahoo, W. Schwarting, A. Amini, S. Karaman, and D. Rus, “Deep orientation uncertainty learning based on a bingham loss,” in ICLR, 2020.
- [34] O. Makansi, E. Ilg, O. Cicek, and T. Brox, “Overcoming limitations of mixture density networks: A sampling and fitting framework for multimodal future prediction,” in CVPR, 2019.
- [35] C. M. Bishop, “Mixture density networks,” 1994.
- [36] E. Brachmann, F. Michel, A. Krull, M. Y. Yang, S. Gumhold, and c. Rother, “Uncertainty-driven 6d pose estimation of objects and scenes from a single rgb image,” in CVPR, 2016.
- [37] M. Bui, T. Birdal, H. Deng, S. Albarqouni, L. Guibas, S. Ilic, and N. Navab, “6d camera relocalization in ambiguous scenes via continuous multimodal inference,” in ECCV, 2020.
- [38] S. Gould, R. Hartley, and D. J. Campbell, “Deep declarative networks,” IEEE TPAMI, 2021.
- [39] D. E. Tyler, “Statistical analysis for the angular central gaussian distribution on the sphere,” Biometrika, vol. 74, no. 3, pp. 579–589, 1987. [Online]. Available: http://www.jstor.org/stable/2336697
- [40] K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in CVPR, 2016.
- [41] V. Lepetit, F. Moreno-Noguer, and P. Fua, “Epnp: An accurate o(n) solution to the pnp problem,” International Journal Of Computer Vision, vol. 81, pp. 155–166, 2009.
- [42] Y. Xu, K.-Y. Lin, G. Zhang, X. Wang, and H. Li, “Rnnpose: Recurrent 6-dof object pose refinement with robust correspondence field estimation and pose optimization,” in CVPR, 2022.
- [43] G. Wang, F. Manhardt, F. Tombari, and X. Ji, “Gdr-net: Geometry-guided direct regression network for monocular 6d object pose estimation,” in CVPR, 2021.
- [44] T. Wang, X. Zhu, J. Pang, and D. Lin, “FCOS3D: Fully convolutional one-stage monocular 3d object detection,” in ICCV Workshops, 2021.
- [45] Z. Tian, C. Shen, H. Chen, and T. He, “Fcos: Fully convolutional one-stage object detection,” in CVPR, 2019.
- [46] J. Dai, H. Qi, Y. Xiong, Y. Li, G. Zhang, H. Hu, and Y. Wei, “Deformable convolutional networks,” in CVPR, 2017.
- [47] I. Loshchilov and F. Hutter, “Decoupled weight decay regularization,” in ICLR, 2019.
- [48] K. He, G. Gkioxari, P. Dollár, and R. Girshick, “Mask r-cnn,” in ICCV, 2017.
- [49] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár, “Focal loss for dense object detection,” IEEE TPAMI, vol. 42, no. 2, pp. 318–327, 2020.
- [50] S. H. Rezatofighi, N. Tsoi, J. Gwak, A. Sadeghian, I. D. Reid, and S. Savarese, “Generalized intersection over union: A metric and A loss for bounding box regression,” in CVPR, 2019.
- [51] E. Xie, Z. Yu, D. Zhou, J. Philion, A. Anandkumar, S. Fidler, P. Luo, and J. M. Alvarez, “M2bev: Multi-camera joint 3d detection and segmentation with unified birds-eye view representation,” 2022.
- [52] F. Tosi, Y. Liao, C. Schmitt, and A. Geiger, “Smd-nets: Stereo mixture density networks,” in CVPR, 2021.
- [53] Y. Liu, T. Wang, X. Zhang, and J. Sun, “Petr: Position embedding transformation for multi-view 3d object detection,” in ECCV, 2022.
- [54] Z. Li, W. Wang, H. Li, E. Xie, C. Sima, T. Lu, Y. Qiao, and J. Dai, “Bevformer: Learning bird’s-eye-view representation from multi-camera images via spatiotemporal transformers,” in ECCV, 2023.
- [55] Y. Jiang, L. Zhang, Z. Miao, X. Zhu, J. Gao, W. Hu, and Y.-G. Jiang, “Polarformer: Multi-camera 3d object detection with polar transformers,” in AAAI, 2023.
- [56] Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo, “Swin transformer: Hierarchical vision transformer using shifted windows,” in ICCV, 2021.
- [57] A. Mousavian, D. Anguelov, J. Flynn, and J. Kosecka, “3d bounding box estimation using deep learning and geometry,” in CVPR, 2017.
- [58] Q. Lian, P. Li, and X. Chen, “Monojsg: Joint semantic and geometric cost volume for monocular 3d object detection,” in CVPR, 2022, pp. 1060–1069.
- [59] S. Agarwal, K. Mierle, and Others, “Ceres solver,” http://ceres-solver.org.
- [60] B. Triggs, P. F. McLauchlan, R. I. Hartley, and A. W. Fitzgibbon, “Bundle adjustment: A modern synthesis,” in International Workshop on Vision Algorithms: Theory and Practice, 2000.
- [61] E. Bingham, J. P. Chen, M. Jankowiak, F. Obermeyer, N. Pradhan, T. Karaletsos, R. Singh, P. Szerlip, P. Horsfall, and N. D. Goodman, “Pyro: Deep Universal Probabilistic Programming,” Journal of Machine Learning Research, 2018.
- [62] I. S. Dhillon and S. Sra, “Modeling data using directional distributions,” 2003.
Hansheng Chen received the M.S.E. and B.E. degree in vehicle engineering from Tongji University, Shanghai, in 2020 and 2023, respectively. He is pursuing the PhD degree in the Computer Science Department of Stanford University. His current research interests lie in computer graphics and 3D vision, with a specific focus on 3D generation, reconstruction, editing, and neural rendering. |
Wei Tian received the B.Sc degree in mechatronics engineering from Tongji University, Shanghai, China, in 2010, and received his the M.Sc. degree in electrical engineering and information technology at KIT, Karlsruhe, Germany, in May 2013. From October 2013, he was with the institute of measurement and control systems at KIT and received the Ph.D. degree in January 2019. From May 2020, he is a leader of comprehensive perception research group at School of Automotive Studies, Tongji University. He is currently working on research areas of robust object detection and trajectory prediction. |
Pichao Wang received the Ph.D. degree in computer science from the University of Wollongong, Wollongong, NSW, Australia. He is currently a Senior Research Scientist in Amazon Prime Video, USA. He has authored 90+ peer reviewed papers, including those in highly regarded journals and conferences such as IJCV, IEEE TMM, CVPR, ICCV, ECCV, ICLR, AAAI, ACM MM, etc. He is the recipient of CVPR2022 Best Student Paper Award. He is named AI 2000 Most Influential Scholar during 2012-2022 by Miner, due to his contributions in the field of multimedia. He is also in the list of World’s Top 2% Scientists named by Stanford University. He serves as the Area Chair of ICME 2021,2022. He also serves as an Associate Editor of Journal of Computer Science and Technology (Tier 1, CCF B). |
Fan Wang received the B.S. and M.S. degrees from the Department of Automation, Tsinghua University, Bei**g, China, and the Ph.D. degree from the Department of Electrical Engineering, Stanford University, Stanford, CA, USA. She is currently working as a Senior Staff Algorithm Engineer with Alibaba Group. Her research interests include object tracking and recognition, 3D vision, and multi-sensor fusion. |
Lu Xiong received the B.E., M.E., and the Ph.D. degrees in vehicle engineering from the School of Automotive Studies, Tongji University, Shanghai, China, in 1999, 2002, and 2005, respectively. From November 2008 to 2009, he was a Postdoctoral Fellow with the Institute of Automobile Engineering and Vehicle Engines, University of Stuttgart, Stuttgart, Germany, with Dr. Jochen Wiedemann. He is currently a Professor with Tongji University and the Deputy Dean of School of Automotive Studies. His research interests include perception, decision and planning, dynamics control and state estimation, and testing and evaluation of autonomous vehicles. |
Hao Li received the Ph.D. degree from the Chinese Academy of Sciences. He is in charge of real-scene visual understanding technologies. He has published more than 20 papers and owns more than 20 licensed patents. His research interests include smart interpretation of remote sensing images, facial recognition-based clocking in systems, new retail, smart campuses, deep learning model compression, facial recognition, person re-identification, and image search. |
Appendix A Levenberg-Marquardt PnP Solver
For parallel processing on GPU, we have implemented a PyTorch-based batch Levenberg-Marquardt (LM) PnP solver. The implementation generally follows the Ceres solver [59]. Here, we discuss some important details that are related to the proposed Monte Carlo pose sampling and derivative regularization.
A.1 LM Step with Huber Kernel
Adding the Huber kernel influences every related aspect from the likelihood function to the LM iteration step and derivative regularization loss. Thanks to PyTorch’s automatic differentiation, the robustified Monte Carlo KL divergence loss does not require much special handling. For the LM solver, however, the residual (concatenated weighted reprojection errors) and the Jacobian matrix have to be rescaled before computing the robustified LM step [60].
The rescaled residual block and Jacobian block of the -th point pair are defined as:
(17) |
(18) |
where
(19) |
(20) |
Following the implementation of Ceres solver [59], the robustified LM iteration step is:
(21) |
where
(22) |
is the square root of the diagonal of the matrix , and is the reciprocal of the LM trust region radius [59].
Note that the rescaled residual and Jacobian affects the derivative regularization, as well as the covariance estimation in the next subsection.
A.1.1 Fast Inference Mode
We empirically observe that in a well-trained model, the LM trust region radius can be initialized with a very large value, effectively rendering the LM algorithm redundant. We therefore use the simple Gauss-Newton implementation for fast inference:
(23) |
where is a small value for numerical stability.
A.2 Covariance Estimation
During training, the concentration of the AMIS proposal is determined by the local estimation of pose covariance matrix , defined as:
(24) |
where is the LM solution that determines the location of the proposal distribution.
Appendix B Details on Monte Carlo Pose Sampling
B.1 Proposal Distribution for Position
For the proposal distribution of the translation vector , we adopt the multivariate t-distribution, with the following probability density function (PDF):
(25) |
where , with the location , the 3×3 positive definite scale matrix , and the degrees of freedom . Following [23], we set to 3. Compared to the multivariate normal distribution, the t-distribution has a heavier tail, which is ideal for robust sampling.
The multivariate t-distribution has been implemented in the Pyro [61] package.
B.1.1 Initial Parameters
The initial location and scale is determined by the PnP solution and covariance matrix, i.e., , where is the 3×3 submatrix of the full pose covariance . Note that the actual covariance of the t-distribution is thus , which is intentionally scaled up for robust sampling in a wider range.
B.1.2 Parameter Estimation from Weighted Samples
To update the proposal, we let the location and scale be the first and second moment of the weighted samples (i.e., weighted mean and covariance), respectively.
B.2 Proposal Distribution for 1D Orientation
For the proposal distribution of the 1D yaw-only orientation , we adopt a mixture of von Mises and uniform distribution. The von Mises is also known as the circular normal distribution, and its PDF is given by:
(26) |
where is the location parameter, is the concentration parameter, and is the modified Bessel function with order zero. The mixture PDF is thus:
(27) |
with the uniform mixture weight . The uniform component is added in order to capture other potential modes under orientation ambiguity. We set to a fixed value of .
PyTorch has already implemented the von Mises distribution, but its random sample generation is rather slow. As an alternative we use the NumPy implementation for random sampling.
B.2.1 Initial Parameters
With the yaw angle and its variance from the PnP solver, the parameters of the von Mises proposal is initialized by .
B.2.2 Parameter Estimation from Weighted Samples
For the location , we simply adopt its maximum likelihood estimation, i.e., the circular mean of the weighted samples. For the concentration , we first compute an approximated estimation [62] by:
(28) |
where is the norm of the mean orientation vector, with the importance weight for the -th sample . Finally, the concentration is scaled down for robust sampling, such that .
B.3 Proposal Distribution for 3D Orientation
Regarding the quaternion-based parameterization of 3D orientation, which can be represented by a unit 4D vector , we adopt the angular central Gaussian (ACG) distribution as the proposal. The support of the 4-dimensional ACG distribution is the unit hypersphere, and the PDF is given by:
(29) |
where is the 3D surface area of the 4D sphere, and is a 4×4 positive definite matrix.
The ACG density can be derived by integrating the zero-mean multivariate normal distribution along the radial direction from to . Therefore, drawing samples from the ACG distribution is equivalent to sampling from and then normalizing the samples to unit radius.
B.3.1 Initial Parameters
Consider to be the PnP solution and to be the estimated 4×4 inverse covariance matrix. Note that is only valid in the local tangent space with rank 3, satisfying . The initial parameters are determined by:
(30) |
where , and is a hyperparameter that controls the dispersion of the proposal for robust sampling. We set to 0.001 in the experiments.
B.3.2 Parameter Estimation from Weighted Samples
Appendix C Details on Derivative Regularization Loss
As stated in the main paper, the derivative regularization loss consists of the position loss and the orientation loss .
For , we adopt the smooth L1 loss based on the Euclidean distance , given by:
(32) |
with the hyperparameter .
For , we adopt the cosine similarity loss based on the angular distance . For 1D orientation parameterized by the angle , . For 3D orientation parameterized by the quaternion vector , . The loss function is therefore defined as:
(33) |
For 3D orientation, after the substitution, the loss function can be simplified to:
(34) |
For the specific settings of the hyperparameter and loss weights, please refer to the experiment configuration code.
Appendix D Details on the Deformable Correspondence Network
D.1 Network Architecture
The detailed network architecture of the deformable correspondence network is shown in Figure 9. Following deformable DETR [27], this paper adopts the multi-head deformable sampling. Let be the number of heads and be the number of points per head, a total number of points are sampled for each object. The sampling locations relative to the reference point are predicted from the object embedding by a single layer of linear transformation. We set to 8, which yields channels for the point features.
The point-level branch on the left side of Figure 9 is responsible for predicting the 3D points and corresponding weights . The sampled point features are first enhanced by the object-level context, by adding the reshaped head-wise object embedding to the point features. Then, the features of the points are processed by the self-attention layer, for which the 2D points are transformed into positional encoding. The attention layer is followed by standard layers of normalization, skip connection, and feedforward network (FFN).
Regarding the object-level branch on the right side of Figure 9, a multi-head attention layer is employed to aggregate the sampled point features. Unlike the original deformable attention layer [27] that predicts the attention weights by linear projection of the object embedding, we adopt the full Q-K dot-product attention with positional encoding. After being processed by the subsequent layers, the object-level features are finally transformed into to the object-level predictions, consisting of the 3D localization score, weight scale, 3D bounding box size, and other optional properties (velocity and attribute). Note that the attention layer is actually not a necessary component for object-level predictions, but rather a byproduct of the deformable point samples whose features can be leveraged with little computation overhead.
D.2 Loss Functions for Object-Level Predictions
As in FCOS3D [44], we adopt smooth L1 regression loss for 3D box size and velocity, and cross-entropy classification loss for attribute. Additionally, a binary cross-entropy loss is imposed upon the 3D localization score, with the target defined as a score function of the position error:
(35) |
where is the XZ components of the PnP solution, is the XZ components of the true pose, and are the linear coefficients. The predicted 3D localization score shall reflect the positional uncertainty of an object, as a faster alternative to evaluating the uncertainty via the Monte Carlo method during inference (Section D.5). The final detection score is defined as the product of the predicted 3D score and the classification score from the base detector.
D.3 Auxiliary Loss Functions
D.3.1 Auxiliary Correspondence Loss
To regularize the dense features, we append an auxiliary branch that predicts the multi-head dense 3D coordinates and corresponding weights, as shown in Figure 10. Leveraging the ground truth of object 2D boxes, the features within the box regions are densely sampled via RoI Align [48], and transformed into the 3D coordinates and weights via an independent linear layer. Besides, the attention weights are obtained via Q-K dot-product and normalized along the dimension and across the overlap** regions of multiple RoIs via Softmax.
During training, we impose the reprojection-based auxiliary loss for the multi-head dense predictions, formulated as the negative log-likelihood (NLL) of the Gaussian mixture model [35]. Following [28], the reprojection error is further robustified by the Huber kernel . The loss function for each sampled point is defined as:
(36) |
where is the head index, is the weighted reprojection error of the -th head at the truth pose . In the above equation, the diagonal matrix is interpreted as the inverse square root of the covariance matrix of the normal distribution, i.e., , and the head attention weight is interpreted as the mixture component weight. is a special operation that takes the overlap** region of multiple RoIs into account, formulating a mixture of multiple heads and multiple RoIs (see code for details).
Another auxiliary loss is the coordinate regression loss that introduces the geometric knowledge. Following MonoRUn [28], we extract the sparse ground truth of 3D coordinates from the 3D LiDAR point cloud. The robustified Gaussian mixture NLL loss for each sampled point with available ground truth is defined as:
(37) |
where is a scalar weight parameter (bounded by activation) to be optimized during training.
As with the KL loss in the main paper, dynamic loss weights [28] are employed to rescale these two auxiliary loss functions.
D.3.2 Auxiliary Depth Loss
For each projected LiDAR point in the image, we extract the feature vector from the interpolated dense feature map, which are then fed into a small 2-layer MLP to predict the scene depth. The output depth is represented by a Gaussian mixture distribution encoded by , where the mixture weights are normalized via Softmax. Given the ground truth depth of this point, the loss function is defined as:
(38) |
where is a weight parameter (bounded by activation) to be optimized during training.
D.4 Training Strategy
During training, we randomly sample 48 positive object queries from the FCOS3D [44] detector for each image, which limits the batch size of the deformable correspondence network to control the computation overhead of the Monte Carlo pose loss.
D.5 Experiments on the Uncertainty of Object Pose
The entropy of the inferred pose distribution reflects the aleatoric uncertainty of the predicted pose. Previous work [28] reasons the pose uncertainty by propagating the reprojection uncertainty learned from a surrogate loss through the PnP operation, but that uncertainty requires calibration and is not reliable enough. In our work, the pose uncertainty is learned with the KL-divergence-based pose loss in an end-to-end manner, which is much more reliable fundamentally.
To quantitatively evaluate the reliability of the pose uncertainty in terms of measuring the localization confidence, a straightforward approach is to compute the 3D localization score via Monte Carlo pose sampling, and compare the resulting mAP against the standard implementation with 3D score predicted from the object-level branch. With the PnP solution , the sampled translation vector , and its importance weight , the Monte Carlo score is computed by:
(39) |
where the subscript denotes taking the XZ components, and the function is the same as in Eq. 35.
As shown in Table VIII, the mAP obtained via Monte Carlo scoring is on par with the standard implementation (0.393 vs. 0.392), indicating that the pose uncertainty is a reliable measure of the detection confidence.
Scoring method | NDS↑ | mAP↑ | mATE↓ | mAOE↓ |
Standard | 0.463 | 0.392 | 0.626 | 0.282 |
Monte Carlo | 0.463 | 0.393 | 0.623 | 0.286 |
Appendix E Notation
Notation | Description | |
Coordinate vector of the -th 3D object point | ||
Coordinate vector of the -th 2D image point | ||
Weight vector of the -th 2D-3D point pair | ||
The set of weighted 2D-3D correspondences | ||
Object pose | ||
Ground truth of object pose | ||
Object pose estimated by the PnP solver | ||
3×3 rotation matrix representation of object orientation | ||
1D yaw angle representation of object orientation | ||
Unit quaternion representation of object orientation | ||
Translation vector representation of object position | ||
Pose covariance estimated by the PnP solver | ||
Jacobian matrix | ||
Rescaled Jacobian matrix | ||
Concatenated vector of weighted reprojection errors of all points | ||
Concatenated vector of rescaled weighted reprojection errors of all points | ||
Camera projection function | ||
Weighted reprojection error of the -th correspondence at pose | ||
Unweighted reprojection error of the -th correspondence at pose | ||
Huber kernel function | ||
The derivative of the Huber kernel function of the -th correspondence | ||
The Huber threshold | ||
Likelihood function of object pose | ||
PDF of the prior pose distribution | ||
PDF of the posterior pose distribution | ||
PDF of the target pose distribution | ||
PDF of the proposal pose distribution (of the -th AMIS iteration) | ||
The -th random pose sample (of the -th AMIS iteration) | ||
Importance weight of the -th pose sample (of the -th AMIS iteration) | ||
Index of 2D-3D point pair | ||
Index of random pose sample | ||
Index of AMIS iteration | ||
Number of 2D-3D point pairs in total | ||
Number of pose samples in total | ||
Number of AMIS iterations | ||
Number of pose samples per AMIS iteration | ||
Number of heads in the deformable correspondence network | ||
Number of points per head in the deformable correspondence network | ||
KL divergence loss for object pose | ||
The component of concerning the reprojection errors at target pose | ||
The component of concerning the reprojection errors over predicted pose | ||
Derivative regularization loss |