## 3 Methodology
### The Proposed Method
#### 3.2.4 Improved IoU Loss  
The initial bounding box regression loss metric utilized in YOLOv8 is the complete intersection over union (CIoU) [24], which can be calculated using Equations (6)-(8). \[L_{CIoU}=1-IoU+\frac{\rho^{2}(B_{pnd},B_{gt})}{c^{2}}+\alpha\
u \tag{6}\]  
\[\
u=\frac{4}{\pi_{2}}(\arctan\frac{w_{gt}}{h_{gt}}-\arctan\frac{w}{h})^{2} \tag{7}\]  
\[\alpha=\frac{\
u}{(1-IoU)+\
u} \tag{8}\]  
In CIoU loss function, \(B_{pnd}\) and \(B_{gt}\) denote the predicted bounding box and the ground truth bounding box, respectively. The Euclidean distance between the center points of these two boxes is represented by \(\rho^{2}(B_{prd},B_{gt})\). Moreover, \(c^{2}\) signifies the diagonal length of the smallest rectangle that can enclose both boxes. \(\alpha\) serves as a positive metric parameter, while \(\
u\) ensures aspect ratio consistency. In the process of detecting eggplant diseases, images often contain some closely spaced or overlapping targets. This results in similar aspect ratios between the predicted boxes and the truth boxes. In such cases, the relative proportion penalty term \(\
u\) becomes less effective, complicating the determination of the distance between the two boxes, which will limit the convergence speed and accuracy of the network. To tackle this problem, this study integrated the advantages of Inner-IoU [25] and MPDIoU [26], proposing a more effective loss function named Inner-MPDIoU to replace CIoU loss. Figure 10[25; 26] depicts the schematic diagram of Inner-MPDIoU. To accelerate the convergence of bounding box loss, an auxiliary (or inner) bounding box is employed. By adjusting the size of this auxiliary bounding box with a scale factor \(r\), it becomes capable of detecting disease targets of varying sizes. Additionally, the regression accuracy of the bounding box is enhanced by comparing the similarity between the two boxes based on the distances between their top-left and bottom-right points. Figure 10: Schematic diagram of Inner-MPDIoU. The expression for Inner-IoU is as follows:  
\[b_{l}^{gt}=x_{c}^{gt}-\frac{w^{gt}*r}{2},\ b_{r}^{gt}=x_{c}^{gt}+\frac{w^{gt}*r}{2} \tag{9}\]  
\[b_{t}^{gt}=y_{c}^{gt}-\frac{h^{gt}*r}{2},\ b_{b}^{gt}=y_{c}^{gt}+\frac{h^{gt}*r}{2} \tag{10}\]  
\[b_{l}=x_{c}-\frac{w*r}{2},\ b_{r}=x_{c}^{gt}+\frac{w^{gt}*r}{2} \tag{11}\]  
\[b_{t}=y_{c}-\frac{h*r}{2},\ b_{b}=y_{c}^{gt}+\frac{h*r}{2} \tag{12}\]  
\[inter=\left(\min\left(b_{r}^{gt},b_{r}\right)-\max\left(b_{l}^{gt},b_{l} \right)\right)*\left(\min\left(b_{b}^{gt},b_{b}\right)-\max\left(b_{t}^{gt},b _{t}\right)\right) \tag{13}\]  
\[union=\left(w^{gt}*h^{gt}\right)*r^{2}+(w*h)*r^{2}-inter \tag{14}\]  
\[\
u=\frac{4}{\pi_{2}}(\arctan\frac{w_{gt}}{h_{gt}}-\arctan\frac{w}{h})^{2} \tag{7}\]0  
The ground truth box's center point, denoted as \(b^{gt}\), and the center point of the inner truth box (also known as the auxiliary box) are both represented by the coordinates \(\left(x_{c}^{gt},y_{c}^{gt}\right)\). Equations (9) and (10) describe the inner truth box. Meanwhile, the prediction box (larger dashed box located at the top right, characterized by width \(w\) and height \(h\)) and the inner prediction box (the smaller dashed box also at the top right, with width \(w_{inner}\) and height \(h_{inner}\)) share a common center point represented by \(\left(x_{c},y_{c}\right)\). Equations (11) and (12) define the inner prediction box. Consistent with CIoU, the bounding box loss for the Inner-IoU function is determined by calculating the IoU between the prediction box and the truth box, as outlined in Equations (13)-(15). In Figure 10, the black rectangle signifies the input image, with \(h^{\prime}\) and \(w^{\prime}\) indicating its height and width. The top-left corner coordinates for the truth and predicted boxes are labeled as \(\left(x_{1}^{gt},y_{1}^{gt}\right)\) and \(\left(x_{1},y_{1}\right)\), while their bottom-right corner coordinates are indicated by \(\left(x_{2}^{gt},y_{2}^{gt}\right)\) and \(\left(x_{2},y_{2}\right)\), respectively.