## 2 Principle and Method  
### Object Detection Based on YOLO Deep Learning Network  
The primary principle of the YOLO technique is to divide an image into a \(7\times 7\) grid. If the center of an object falls in a grid, the grid is responsible for predicting the object. Here, each grid must predict two bounding boxes, and each bounding box predicts (\(x\), \(y\), \(w\), \(h\)) and the confidence level, where (\(x\), \(y\)) represents the position of the center point of the bounding box, and (\(w\), \(h\)) represents the width and height of the bounding box after normalization relative to the entire image. The confidence level includes the probability that the bounding box will contain the target _Pr(object)_ and the accuracy of the bounding box (the intersection ratio of the prediction box and the actual box) _IOUtruth_, i.e., \(confidence=Pr(object)\times IOUtruth_{pred}^{truth}\). Note that a high confidence level indicates that there is a target in the bounding box and that the position is accurate. In contrast, a low confidence level indicates that there may be no target or, if there is a target, there is a large position deviation. In addition, each grid must predict the target categories, and the probability of each category is denoted \(P(C_{i}|object)\). Initially, 20 categories can be predicted. Finally, the predicted object information is a \(7\times 7\times 30\) tensor. The prediction frame and category information extracted from it are processed by non-maximum suppression to output the prediction result for the given image. The network structure of YOLO is motivated by the GoogleNet model. The YOLO network comprises 24 convolution layers, four max-pooling layers, and two fully connected layers. The convolution layer of \(3\times 3\) is connected after the restoration layer of \(1\times 1\) to replace the GoogleNet's Inception module. The YOLO network structure is illustrated in Figure 1.  
YOLO employs the mean square error as the loss function, which comprises the positioning loss, confidence loss, and classification loss. Here, the positioning loss is used to measure the bounding box's central coordinate error and the bounding box's width and height error. Note that smaller target bounding boxes are disturbed by deviations caused by positioning loss. To make the model pay focus to the bounding box containing the target, the confidence loss weight of the bounding box containing the target is typically set to 1, and the confidence loss weight of a bounding box without the target is 0.5. After setting the above parameters, the classification loss is calculated only when targets are present in the grid. Here, each grid has multiple bounding boxes but corresponds to only a single category; thus, only the box with the giant IOU of the ground truth is selected for training. The loss function is divided into the following three expressions. Positioning loss formula:\[\lambda_{coord}\sum_{i=0}^{S^{2}}\sum_{j=0}^{B}1_{ij}^{obj}\Big{[}(x_{i}-\hat{x}_ {i})^{2}+(y_{i}-\hat{y}_{i})^{2}\Big{]}+\lambda_{coord}\sum_{i=0}^{S^{2}}\sum_{j =0}^{B}1_{ij}^{obj}\Bigg{[}\left(\sqrt{w_{i}}-\sqrt{\hat{w}_{i}}\right)^{2}+ \left(\sqrt{h_{i}}-\sqrt{\hat{h}_{i}}\right)^{2}\Bigg{]} \tag{1}\]  
Confidence loss formula:  
\[\sum_{i=0}^{S^{2}}\sum_{j=0}^{B}1_{ij}^{obj}\big{(}C_{i}-\hat{C}_{i}\big{)}^{2} +\lambda_{noobj}\sum_{i=0}^{S^{2}}\sum_{j=0}^{B}1_{ij}^{noobj}\big{(}C_{i}- \hat{C}_{i}\big{)}^{2} \tag{2}\]  
Classification loss formula:  
\[\sum_{i=0}^{S^{2}}1_{i}^{obj}\sum_{c\in class}\left(p_{i}(c)-\hat{p}_{i}(c) \right)^{2} \tag{3}\]  
Here, \(S\) represents the grid, and \(B\) represents the number of prediction boxes; 1 is an indicating function with only two values, i.e., 0 and 1. If a target is present in grid \(i\), \(1_{i}^{obj}\) is set to 1; otherwise, it is set to 0. \(1_{ij}^{obj}\) indicates that the \(j\)th prediction box in grid \(i\) predicts the grid.