# Edge-YOLO: Lightweight Infrared Object Detection Method Deployed on Edge Devices
## 3 Methods
### Improved Bounding Box Loss Function EX-IoU  
The latest version of the YOLOv5 algorithm (version 6.2) uses the Complete-IoU (CIoU) as its bounding box loss function, as proposed by [PERSON] [15]. The CIoU integrates three aspects of the intersection-union ratio (IoU) between the predicted box and the ground truth box: the ratio of the distance between their centroids to the length of the diagonal of the minimum outer rectangle, and the similarity of their aspect ratios. The equation for the CIoU is as follows:  
\[\left\{\begin{array}{c}L_{CIoU}=1-IoU+\frac{\rho^{2}\left(b,b^{st}\right)}{c ^{2}}+\alpha v\\ \alpha=\frac{v}{(1-IoU)+\alpha}\\ v=\frac{4}{\pi^{2}}\left(\arctan\frac{\pi\pi^{2}}{h\pi^{2}}-\arctan\frac{\pi }{h}\right)^{2}\end{array}\right. \tag{1}\]  
where \(\alpha\) is the weight coefficient, \(\rho\left(b,b^{st}\right)\) is the distance between the center point of the predicted box and the ground truth box, \(c\) is the diagonal length of the minimum outer rectangle, \(v\) indicates the difference between the aspect ratio of the predicted box and the ground truth box, and \(v\) is 0 if they have the same aspect ratio.  
Figure 2: The network structure of Edge-YOLO.  
The CIoU metric used in the current version of the YOLOv5 algorithm is designed to integrate three aspects of the intersection-union ratio IoU between the prediction box and the ground truth box. However, the aspect ratio used in CIoU is a relative value, which can introduce uncertainty during calculation and potentially hinder the optimization of the model. To address this issue, we propose the use of Efficient-IoU (EIoU) as the bounding box loss function, as proposed by [PERSON] et al. [16]. EIoU splits the aspect ratio based on CIoU and replaces the original aspect ratio difference between the predicted box and ground truth box with the ratio of the width difference between the predicted box and the ground truth box to the width of the minimum circumscribed rectangle, and the ratio of the height difference to the height of the minimum outer rectangle. This approach leads to a more accurate bounding box loss function and facilitates better model optimization. The formula is as follows:  
\[L_{EIoU}=1-IoU+\frac{\rho^{2}\big{(}b,b^{gt}\big{)}}{c^{2}}+\frac{\rho^{2} \big{(}w,w^{gt}\big{)}}{C_{w}^{2}}+\frac{\rho^{2}\big{(}h,h^{gt}\big{)}}{C_{h} ^{2}} \tag{2}\]  
where \(C_{w}\) and \(C_{h}\) denote the width and height of the minimum outer rectangle, respectively. The literature [17] proposes to use the hyperparameter \(\alpha\) as a power on each term in the loss function IoU, with the following simplified formula.  
\[L_{\alpha-IoU}=1-IoU^{\alpha} \tag{3}\]  
The parameter \(\alpha\) is crucial in emphasizing the importance of the loss and gradient of objects with high IoU, thereby enhancing the accuracy of the bounding box regression. To improve the bounding box loss function, this paper incorporates the power \(\alpha\) into the EIoU equation, resulting in a new function known as EX-IoU. This function exponentially magnifies the importance of the IoU value, centroid distance, width difference, or height difference between any predicted box and the ground truth box, leading to an exponential reduction effect on losses and an improvement in the accuracy of the bounding box regression. The optimal value of \(\alpha\) is determined through experiments discussed in Section 4.  
\[L_{EX-IoU}=1-IoU^{\alpha}+\frac{\rho^{2\alpha}\big{(}b,b^{gt}\big{)}}{c^{2 \alpha}}+\frac{\rho^{2\alpha}\big{(}w,w^{gt}\big{)}}{C_{w}^{2\alpha}}+\frac{ \rho^{2\alpha}\big{(}h,h^{gt}\big{)}}{C_{h}^{2\alpha}} \tag{4}\]