## 3 Methodology
### Implementation Details
#### 3.2.4 Wise-IoU  
The selection of the bounding box loss function and its clear definition are pivotal in the target monitoring model. In the original YOLOv8 network, the Complete Intersection over Union (CIoU) loss is used as the bounding box loss function. The CIoU loss takes into account three important geometric factors: the area of overlap, the distance between centers, and the aspect ratio. This significantly improves the accuracy of the object localization, enabling the model to perform better in complex scenarios. In Figure 7, assume that the anchor box is \(\overset{\rightarrow}{B}= \begin{bmatrix}x&y&w&h\end{bmatrix} \) and the target anchor box is \(\overset{\rightarrow}{B}_{gt}= \begin{bmatrix}x_{gt}&y_{gt}&w_{gt}&h_{gt}\end{bmatrix} \). Then, the CIoU is defined as shown in Equations (8)-(11), where \(L_{\text{IoU}}\) and \(L_{\text{CIoU}}\) represent the IoU and CIoU losses, respectively. \(\alpha v\) is the penalty coefficient of the CIoU, where \(\alpha\) is the equilibrium coefficient, and it does not participate in gradient calculation and assigns priority according to the value of the IoU. \(v\) is used to calculate the consistency of the aspect ratio of the prediction frame and the target frame, as measured by the tan angle. \[L_{IoU}=1-IoU=1-\frac{W_{i}H_{i}}{S_{u}},S_{u}=wh+w_{gt}h_{gt}-W_{i}H_{i} \tag{8}\]  
\[L_{CIoU}=L_{IoU}+\frac{\left(x-x_{gt}\right)^{2}+\left(y-y_{gt}\right)^{2}}{ \left(W_{g}^{2}+H_{g}^{2}\right)}+\alpha v \tag{9}\]  
\[\alpha=\frac{v}{L_{IoU}+v} \tag{10}\]  
\[v=\frac{4}{\pi^{2}}\bigg{(}\arctan\frac{w_{gt}}{h_{gt}}-\arctan\frac{w}{h} \bigg{)}^{2} \tag{11}\]  
However, [PERSON] et al. [63] have pointed out that the original model encounters difficulties with the uneven quality of regression samples, where only the differences in the aspect ratio are reflected, rather than the actual relationships between the \(w\) and \(w_{gt}\) or \(h\) and \(h_{gt}\). This leads to poorer-quality regression samples having a greater impact on the loss, while higher-quality samples are difficult to further optimize. This  
Figure 7: Schematic diagram of CIoU inference. Here, the red represents the real box, and the blue represents the prediction box. The red line represents the distance between the center point of the prediction box and the real box. convergence, lower efficiency, and less precise prediction boxes. Although the authors proposed Focal EIoU\({}_{v1}\) to address the issue of the uneven quality of regression samples, it used a static focusing mechanism (FM) and did not fully exploit the potential of the FM. To more comprehensively solve this issue, a new loss function is introduced, the Wise-IoU\({}_{v3}\) (WIoU\({}_{v3}\)) [64], which includes a dynamic non-monotonic FM. This improvement aims to achieve a better-quality balance, enhancing the efficiency of the model training and the accuracy of the prediction boxes. The WIoU includes WIoU\({}_{v1}\), WIoU\({}_{v2}\), and WIoU\({}_{v3}\). V1 constructs an attention-based bounding box loss (expressed specifically as Equations (12) and (13)). V2 and V3 introduce a method of calculating the gradient gain (focusing coefficient) on top of this, adding a focusing mechanism:  
\[L_{WIoU_{v1}}=R_{WIoU}\times L_{IoU} \tag{12}\]  
\[R_{WIoU}=\exp\left(\frac{\left(x-x_{gt}\right)^{2}+\left(y-y_{gt}\right)^{2}} {\left(W_{g}^{2}+H_{g}^{2}\right)^{*}}\right) \tag{13}\]  
In Equations (12) and (13), the following apply:  
* When \(R_{WIoU}\in[1,e)\), significantly enlarge the anchor box (\(L_{IoU}\)) of ordinary quality;
* When \(L_{IoU}\in[0,1]\), significantly reduce the width of the high-quality anchor box and shorten the center point distance when the anchor box overlaps with the target box;
* The superscript
* indicates that \(W_{g}\) and \(H_{g}\) are separated from the calculation graph, which effectively prevents the \(R_{WIoU}\) from generating a gradient that hinders convergence.