## 2 YOLO Algorithm Statistics and Optimization
### Monitoring Principle  
The YOLO algorithm is only used for target detection; it does not have a statistical function. To obtain traffic flow statistics, we first need to achieve accuracy while using YOLO to detect the traffic flow, and then we can obtain useful statistics. The monitoring principles are as follows:  
1. YOLO divides each input image into \(\text{S}\times\text{S}\) (S = 7) grids, each of which is responsible for predicting the targets that fall into the center of the grid, as shown in Figure 3[29; 31]. 2. The convolutional network extracts features. Each grid aims to predict \(B\) (\(B\) = 2) bounding boxes and \(C\) shared class probabilities for a detected object, and each bounding box contains five parameters  
in the image or video, which causes problems, such as repetition of traffic flows or leakage statistics, which affects the statistical accuracy. Hence, it is very important to use another algorithm to improve the detection accuracy. Previously, [PERSON] et al. proposed using a deep residual network to enhance the automatic learning of hierarchical aesthetics representation; they found that network performance increased with the number of layers [34; 35]. For this reason, we tried adding a layer of fully connected layers that are based on the YOLO network and used the dropout function to prevent overfitting. The regression bounding box is the most important part of computer vision; target detection and tracking depend on having an exact regression bounding box. The traditional methods used to enhance network performance for detection and tracking are deeper backbone networks or better methods to extract local features [34; 36; 37]. However, both of the methods ignore the optimization of loss functions. IOU is an evaluation metric that can be used to measure the accuracy of an object detector in a particular dataset; it can also be used as an overlapping region metric that is insensitive to scale changes and non-negative [21; 31]. If IOU can be used to optimize the loss function directly, it is easy to solve the problems as when that the two boxes were non-intersected and IOU is set to equal to 0, which is equivalent to the loss function without optimization. In addition, IOU cannot address the problem of two-frame overlapping alignment, as shown in Figure 4. The black solid wire frame is the target frame, and the black area is where intersection occurs. In the three cases, the IOUs are the same, but the overlapping modes are different; the effect on the left is the best, and the effect on the right is the worst. Although IOU is the most popular evaluation metric used in detection benchmarks for moving objects, it has an apparent difference between common optimization used distance losses to regress the parameters of a bounding frame and maximizing this metric value. We try to optimize the loss function of IOU and solve location problems in view of these shortcomings. GIOU metric parameters are proposed for solving location problems, i.e., and GIOU is defined as that IOU subtracts the proportion of non-two-frame area to the minimum closure area [32]. In this case, the minimum closure area is surrounded by the minimum coordinates of the upper left corner of the two frames and the maximum coordinates of the lower right corner of the two frames, as shown by the black dotted line in Figure 4. The range of values is set between -1 and 1. Let the predicted coordinates be \(\left(x_{\min}^{p},\ y_{\min}^{p},\ x_{\max}^{p},\ y_{\max}^{p}\right)\) and the real coordinates be \(\left(x_{\min}^{t},\ y_{\min}^{t},\ x_{\max}^{t},\ y_{\max}^{t}\right)\). Subsequently, the intersection area of the two frames can be calculated while using Equations (1)-(3).