# NGIoU Loss: Generalized Intersection over Union Loss Based on a New Bounding Box Regression
## 3 NGIoU Loss
As observed from Figure 3, the loss function proposed in this paper provides a moving gradient and speeds up the decline of the loss value, thus better compensating for the deficiencies of the GIoU Loss function. The following Figure 4 shows the comparison of performance indicator curves of different loss functions under different IoU thresholds. It is observed from Figure 4 that under different IoU thresholds, the mAP trained by CIoU and GIoU Loss functions is generally higher than that trained by GIoU Loss function. Especially, when IoU thresholds are between 0.6 and 0.8, the mAPs gradually overlap in the later stage. Compared with the CIoU Loss function, the mAP of our algorithm improves a bit, and there is no obvious difference in the mAP until the IoU threshold is 0.75. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Loss** & **AP** & **AP50** & **AP75** \\ \hline GIoU & 46.53\% & 79.30\% & 48.72\% \\ \hline CIoU & 46.81\% & 79.52\% & **50.81\%** \\ Relative improv. \% & 0.28\% & 0.22\% & **2.09\%** \\ \hline NGIoU & **47.68\%** & **81.12\%** & 50.77\% \\ Relative improv. \% & **1.15\%** & **1.82\%** & 2.05\% \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The comparison of performance indicators with different loss functions in the YOLOv4 algorithm. ### YOLOv5 Algorithm Based on PASCAL VOC 2007

YOLOv5 is slightly inferior to YOLOv4 in performance, but has significantly improved flexibility and speed. YOLOv5 is chosen as the one-stage anchor-based model,which applies Auto Learning Bounding Box Anchors. Backbone is CSPDarknet53, including Focus network structure. A mix of mosaic data augmentation and cutmix data augmentation is used to splice images from the data set. In order to speed up the training efficiency of the model and increase the number of positive samples, during the training, each real box will be predicted by multiple prior bounding boxes, score sorting and non-maximum suppression screening are also used to obtain prediction boxes. The metrics used in the experiments to measure the precision of the method are the mAP (mAP50) and the Recall Rate, which separately measure the precision of detection and the degree of missed detection. The Pytorch framework is used for this experiment. In terms of experimental parameters, the SGD optimizer is used with the Momentum being 0.9, and no weight decay is set. The initial learning rate is set to \(1\times 10^{-3}\), and Cosine Annealing LR is used. The batch size is set to 8. Table 2 shows the results of the various Loss function compared to the YOLOv5 algorithm. It is observed from Table 2 that the NGIoU Loss function has the highest mAP value (86.79%). The YOLOv5 model with NGIoU Loss function does not achieve the highest ap value when predicting objects of boat, bottle, sheep and other categories. Although the overall ap value is improved, the improvement of NGIoU Loss function has certain limitations. In addition, The network training time with NGIoU loss function is 49 minutes shorter than that with the GIoU Loss function, and has slight advantages over those with the CIoU loss function.