# AuxDepthNet: Real-Time Monocular 3D Object Detection with Depth-Sensitive Features
## 3 Proposed Method
### Loss Function  
The proposed framework adopts a single-stage detector design, which directly predicts object bounding boxes and class probabilities using pre-defined 2D-3D anchors. This architecture is optimized for efficient object detection and depth estimation in a single forward pass. To handle challenges such as class imbalance and bounding box regression, the framework incorporates Focal Loss [30; 31] for classification and Smooth L1 Loss [32; 33] for bounding box regression. These loss functions are combined with a custom depth loss to ensure robust performance across all tasks. For the classification task, we use Focal Loss to address class imbalance by down-weighting easy examples and emphasizing hard ones. For each positive anchor \(i\), let \(p_{i}\) denote the predicted probability that the anchor belongs to the positive class, and let \(p_{i}^{gt}\in\{0,1\}\) be the ground-truth label. The Focal Loss for a single anchor is defined as follows:  
\[FocalLoss\Big{(}p_{i},p_{i}^{gt}\Big{)}= \begin{cases}-\alpha(1-p_{i})^{\gamma tgg }p_{i},if\ p_{i}^{gt}=1,\\ -(1-\alpha)p_{i}^{\gamma tgg}(1-p_{i}),if\ p_{i}^{gt}=0,\end{cases}  \tag{10}\]  
Figure 5: Overview of the proposed Depth Position Mapping (DPM) module. This process aligns spatial features with depth information, enhancing the model’s 3D geometric understanding. where \(p_{i}\) is the predicted probability of anchor \(i\) being positive, and \(p_{i}^{gt}\) is the ground-truth label for anchor \(i\) (either 0 or 1). \(\alpha\) is a balancing factor that controls the importance of positive versus negative examples, and \(\gamma\) is a focusing parameter that reduces the loss contribution from easy examples and focuses on harder ones. The loss is averaged over all positive anchors:  
\[L_{cls}=\frac{1}{N_{pos}}\sum_{i=1}^{N_{pos}}FocalLoss\left(p_{i},p_{i}^{gt} \right), \tag{11}\]  
where Npos is the number of positive anchors. For bounding box regression, we adopt Smooth L1 Loss. Let \(\delta_{i}=b_{i}-b_{i}^{gt}\) be the difference between the predicted bounding box b\({}_{i}\) and the ground-truth bounding box \(b_{i}^{gt}\), where \(b_{i}\) and \(b_{i}^{gt}\) represent the predicted and ground-truth bounding box parameters, respectively. The Smooth L1 Loss is defined as follows:  
\[SmoothL1(\delta_{i})=\left\{ \begin{aligned} & 0.5\times\frac{\delta^{2}}{ \beta},if\ |\delta_{i}|<\beta,\\ &|\delta_{i}|-0.5\times\beta,if\ |\delta_{i}|\geq\beta,\end{aligned} \right. \tag{12}\]  
where \(\beta\) is a threshold that controls the transition between L1 and L2 loss. This loss is less sensitive to outliers compared to L2 loss and is computed as follows:  
\[\mathcal{L}_{reg}=\frac{1}{N_{pos}}\sum_{i=1}^{N_{pos}}SmoothL1\left(b_{i},b_ {i}^{gt}\right) \tag{13}\]  
where \(N_{pos}\) is the number of positive anchors, and \(\delta_{i}=b_{i}-b_{i}^{gt}\) is the difference between the predicted and ground-truth bounding box parameters. In addition to the classification and regression losses, we introduce a depth estimation loss to enable depth-sensitive feature learning. To do this, we discretize the continuous depth range into \(D\) bins, and the model outputs a probability distribution over these bins for each pixel. Let \(d_{i,b}^{gt}\in[0,1]\) denote the ground-truth probability for depth bin \(b\) at pixel \(i\), and \(d_{i,b}\in[0,1]\) denote the predicted probability for that bin. The depth loss is then formulated as follows:  
\[L_{depth}=-\frac{1}{N}\sum_{i=1}^{N}\sum_{b=1}^{D}w_{i,b}d_{i,b}^{gt}logd_{i,b} \tag{14}\]  
where N is the total number of valid pixels, and \(w_{i,b}=\left(1-d_{i,b}^{gt}\right)^{-\gamma}\) is a weighting factor that emphasizes harder-to-predict depth bins. The term w\({}_{i,b}\) follows the same principle as Focal Loss, where bins with higher uncertainty or difficulty are weighted more heavily. Depending on whether a one-hot or soft labeling strategy is used, \(d_{i,b}^{gt}\) can be 1 for the true bin and 0 otherwise, or distributed across several bins in a soft fashion.