# RCBi-CenterNet: An Absolute Pose Policy for 3D Object Detection in Autonomous Driving
## 4 RCBi-CenterNet
### Detection Head  
As discussed in Section 3.2, our prediction target is a seven tuple (yaw, pitch, roll, x, y, z, confidence), in which the first six variables describe an absolute pose of a detected vehicle and the last one is a confidence score. The detection head consists of two branches. The first branch predicts a center point heatmap that gives the confidence scores at each location, and the second branch predicts a tensor that regresses the orientation (yaw, pitch, and roll) and the depth (z). The idea to produce the confidence scores is from [PERSON] et al. [20]. Let \(I\in\mathbb{R}^{W\times H\times 3}\) be a \(W\times H\) image and let \(\mathbf{H}\) be the ground truth center point heatmap \(\mathbf{H}\in[0,1]^{\frac{W}{K}\times\frac{H}{K}}\), where \(R\) is the output stride to scale down the image by a factor of \(R\). For each ground truth center point \(p(x,y,z)\) in the 3D world space, we convert it to a 2D point \(p^{\prime}(x^{\prime},y^{\prime})\) in the image, and then scale it down to obtain the corresponding location \(p(\bar{x},\bar{y})\) in the low-resolution heatmap. Let \(\mathbf{H}_{\bar{x},\bar{y}_{+}}\) denote a ground true center point located at \((\bar{x}_{+}\bar{y}_{+})\) of the heatmap. We then apply a Gaussian kernel [20]\(\mathbf{H}_{\bar{x}\bar{y}}=\exp\left(-\frac{(\bar{x}-\bar{x}_{+})^{2}+(\bar{y }-\bar{y}_{+})^{2}}{2\sigma^{2}}\right)\), where \(\sigma\) denotes the vehicle size-adaptive standard deviation. The Gaussian kernel helps transform each ground truth center point to a circular area in \(\mathbf{H}\) so that the near pixels of the center point can also receive a positive score, depending on their closeness to the circle center. This transformation effectively creates more pixels with positive labels and facilitates model training [20]. Part of the learning goal is to generate a center point heatmap \(\mathbf{H}^{\prime}\in[0,1]^{\frac{W}{K}\times\frac{H}{K}}\) to approximate \(\mathbf{H}\) and minimize the prediction error. For both \(\mathbf{H}\) and \(\mathbf{H}^{\prime}\), if there is an overlap between two Gaussians, the element-wise maximum is taken. Lastly, given that the positive samples, namely pixels with a value greater than 0.5, are far less than the negative samples, there exists an imbalanced sample distribution. In other words, the majority of an input image is background. Therefore, we adopt focal loss to handle this imbalanced distribution. The loss function is given as follows:  
\[L_{\mathbf{H}}=-\frac{1}{S_{\mathbf{H}}}\sum_{\pi\bar{y}}\Bigl{(}\mathbf{H}_{ gg}\alpha(1-\hat{\mathbf{H}}_{gg})^{\gamma}\log(\hat{\mathbf{H}}_{gg})+(1- \mathbf{H}_{gg})(1-\alpha)\hat{\mathbf{H}}_{\bar{x}\bar{y}}^{\gamma}\log(1- \hat{\mathbf{H}}_{gg})\Bigr{)} \tag{3}\]  
Figure 6: RFP unrolled to a two-step sequential network; A.B. and L.B. refer to assistant backbone and lead backbone, respectively. where \(\alpha\) and \(\gamma\) are hyper-parameters of the focal loss and \(S_{\mathbf{H}}\) is the size of the heatmap, which is \(\frac{W}{R}\times\frac{H}{R}\). The other branch of the detection head is to predict the pose information, which is done by regression. Instead of predicting a 3D coordinate \((x,y,z)\) directly, we choose to predict \((\tilde{x},\tilde{y},z)\), and then convert \(\tilde{x}\) and \(\tilde{y}\) into the corresponding 3D coordinates. The output of this branch is a tensor \(\hat{\mathbf{P}}\in\mathbb{R}^{\frac{W}{R}\times\frac{H}{R}\times 4}\). We can then define \(\hat{\mathbf{P}}_{gg}=(yaw,pitch,roll,z)\), a four-element tuple, as the orientation and the depth of the vehicle object detected at \((\tilde{x},\tilde{y})\) in the heatmap. We employ the L1 loss to regress the pose information as follows:  
\[L_{\mathbf{P}}=\frac{1}{S_{\mathbf{H}}}\sum_{\tilde{x}\tilde{y}}\bigl{(}\| \mathbf{P}_{xy}-\hat{\mathbf{P}}_{gg}\|\mathbf{H}_{xy}\bigr{)} \tag{4}\]  
Note that both \(L_{\mathbf{H}}\) and \(L_{\mathbf{P}}\) calculate the loss for a single image.