# Iae-km3D a 3D Object Detection Method Based on an Improved KM3D Network
## 2 Methodology
### IAE-KM3D: Improved Algorithm for KM3D
#### 2.2.5 Key Point Loss Function  
The most critical loss function of KM3D is the key point loss function \(L_{k}\). Taking the training stage as an example, KM3D calculates the loss \(L_{k}\) for positive and negative samples through the difference between the predicted value \(\overset{\wedge}{Y}_{XYC}\) on the heat map and the actual value \(Y_{XYC}\) mapped on the heat map, respectively. When the actual value \(Y_{XYC}=1\), for the easy-to-split samples, if the predicted value \(\overset{\wedge}{Y}_{XYC}\) is close to 1, the value of \(\left(1-\overset{\wedge}{Y}_{XYC}\right)^{\alpha}\) is relatively small and the calculated loss is small, and it has a corrective effect on the easy-to-split samples; for the difficult-to-split samples, if the predicted value \(\overset{\wedge}{Y}_{XYC}\) is close to 0, the value of \(\left(1-\overset{\wedge}{Y}_{XYC}\right)^{\alpha}\) is relatively large and the calculated loss is more significant, increasing the weight of sample training. When the actual value is \(Y_{XYC}\
eq 1\), the predicted value of \(\overset{\wedge}{Y}_{XYC}\) is expected to be close to 0. If the value is more significant, \(\left(1-\overset{\wedge}{Y}_{XYC}\right)^{\alpha}\) will be used as a more significant weight, and the punishment of the sample will be more significant; if the predicted value is close to 0, \(\left(\overset{\wedge}{Y}_{XYC}\right)^{\alpha}\) will be smaller, and its training loss weight will be reduced. Although the key point loss function L\({}_{\text{k}}\) can effectively regulate the training weights for complex and easy samples, the weighting factors \(\left(1-\overset{\wedge}{Y}_{XYC}\right)^{\alpha}\) and \(\left(\overset{\wedge}{Y}_{XYC}\right)^{\alpha}\), which regulate the loss weights of the training samples, cannot apply different loss weights to samples with different degrees of difficulty because the hyper-parameter \(\alpha\) of the weighting factors is fixed at 2, which applies the same loss weights to the easy and complex samples. However, theoretically, the loss weights applied to the easy-to-score samples should be more significant to reduce their training weights further; on the contrary, the weights applied to the difficult-to-score samples should be reduced and the training weights should be increased, which enables the model to reduce the attention to the easy-to-score samples and focus on the difficult-to-score samples that are more effective, and thus improves the performance of the model. Aiming at the above problems, this paper proposes a key point loss function L\({}_{\text{k1}}\) based on the predicted value \(\overset{\wedge}{Y}_{XYC}\) linearly adjusted magnitude, as shown in Equation (8).  
\[L_{k1}=\frac{-1}{N}\underset{xyc}{\sum}\left\{\begin{array}{l}\left(1- \overset{\wedge}{Y}_{XYC}\right)^{m}\ln(\overset{\wedge}{Y}_{XYC}),Y_{xyc}=1\\ \left(1-Y_{XYC}\right)^{\beta}(\overset{\wedge}{Y}_{XYC})^{n}\ln(1-\overset{ \wedge}{Y}_{XYC}),otherwise\end{array}\right. \tag{8}\]  
\(m,n\in[2,\eta]\), \(m=2+(\eta-2)\times\overset{\wedge}{Y}_{XYC}\), \(n=\eta-(\eta-2)\times\overset{\wedge}{Y}_{XYC}\), \(\eta\) is the optimal value of magnitude adjustment, a natural number not less than 2; \(m\) and \(n\) vary linearly with the predicted value \(\overset{\wedge}{Y}_{XYC}\), with a minimum value of 2 and a maximum value of \(\eta\). By varying the value of \(\eta\), the improved key point loss function can effectively adjust the training weight of the model on complex and easy samples. When \(\eta\) is 2, \(L_{k1}\) and \(L_{k}\) loss functions are equivalent, and when \(\eta\) is 4, the model has better convergence and the most outstanding detection ability. Hence, this paper chooses \(\eta\) = 4 as the optimal value for magnitude adjustment.