# KCFS-YOLOv5: A High-Precision Detection Method for Object Detection in Aerial Remote Sensing Images
## 3 Improvements of the KCFS-YOLOv5
### Optimization of the Loss Function  
Tiny objects in aerial remote sensing images place extremely onerous requirements on the precision of the loss function in the network because of their tiny feature objects and important texture information. The loss function is used at the output of the original YOLOv5s framework, relying on it to calculate the deviation value between the predicted box and the ground truth box of the detection object. The conventional YOLOv5s uses the GIoU loss function [45] as the function of the predicted box; the complete function  
Figure 8: The framework of the improved object detection module. Figure 9: This is the comparison results using the improved object detection module and the original YOLOv5. (**a**) is the result of the conventional YOLOv5, (**b**) is the result of the improved object detection module. is represented as follows: first, the minimum circumscribed rectangle \(C\) of the two \(AB\) detection boxes can be calculated, and then the ratio of the size of the \(AB\) area difference set to the area of the circumscribed rectangle \(C\) is calculated, and then the GIoU is attained by subtracting this ratio from the IoU value of \(AB\). Compared with the IoU function of the early YOLO series, although GIoU solves the problem that IoU is not steerable in some cases and cannot be judged when the IoU is the same, but when the predicted box overlaps with the ground truth box, GIoU will return to IoU, repeating the above problems; the subsequently proposed CIoU loss function [46] takes into account information such as the height-width ratio of the frame and the position of the center. Although it solves the problem of box overlap, it ignores the deviation in the orientation between the ground truth box and the predicted box, which leads to \"wandering\" of the predicted frame in the training process, and finally affects the updating of the weight, so as to reduce the detection performance. \[GIoU_{Loss}=(\text{IOU}-\frac{C-(A\cup B)}{C}) \tag{13}\]  
The SIoU [44] is an improved loss function based on the CIoU and GIoU function. It considers the vector angle between ground truth box and the predicted box, providing regression direction guidance for predicted box, and redefining the penalty function. In the tiny object detection-based remote sensing images, the performance of object detection results can be improved. Its working principle is to calculate the angle loss value between the ground truth box and the predicted box, as defined by:  
\[\Lambda=1-2\times sin^{2}(arcsin(\frac{C_{h}}{\sigma})-\frac{\pi}{4})=cos(2 \times(arcsin(\frac{C_{h}}{\sigma})-\frac{\pi}{4})) \tag{14}\]  
where \(C_{h}\) is the height difference between the center point between the predicted box and the ground truth box, and \(\sigma\) is the deviation in distance between the center point of the predicted box and the ground truth box. The process is shown in Figure 10.  
The deviation in distance between the prediction box and the detection box can be defined as follows:  
\[\triangle=\sum_{t=x,y}(1-e^{-\gamma\rho t})=2-e^{-\gamma\rho x}-e^{-\gamma\rho y} \tag{15}\]  
\[\rho_{x}=(\frac{b_{C_{x}}^{gt}-b_{C_{x}}}{C_{w}})^{2},rho_{y}=(\frac{b_{C_{y}} ^{gt}-b_{C_{y}}}{C_{h}})^{2},gamma=2-\Lambda \tag{16}\]  
Figure 10: Calculation of the angle loss value. where \(h_{w}\) and \(h_{h}\) are the minimum enclosing rectangle of the ground truth box and the predicted box, respectively. The process is shown in Figure 11.  
Evaluation of loss shape is defined as:  
\[\Omega=\left(1-e^{-w_{w}}\right)^{\theta}+\left(1-e^{-w_{h}}\right)^{\theta} \tag{17}\]  
Figure 9:0  
where (\(w\),\(h\)) and (\(w^{gt}\),\(h^{gt}\)) denote the width and height of the predicted box and the ground truth box, respectively, and \(\theta\) represents the degree of attention that the loss function pays to the shape loss.