## 3 Our Proposed Object Detection Algorithm Combined with Varyblock
### Training and Prediction of Network Model  
The network model can be used to forecast the object detection results of the input image once it has been trained. The loss function in the training process is presented in Equation (1):  
\[ \begin{split} loss=&\ \frac{1}{n}\sum_{i=1}^{n} loss_{wh}+\frac{1}{n}\sum_{i=1}^{n} loss_{class}\\ &+\frac{1}{n}\sum_{i=1}^{n}loss_{confidence}\end{split}  \tag{1}\]  
\[ \begin{split} loss_{wh}&=\lambda_{coord}\sum_{i=0}^{ \sum_{j=0}^{2}}1_{i,j}^{obj}(2-w_{i}\times h_{i})\\ &\times\left[\left(x_{i}-\hat{x}_{i}\right)^{2}+\left(y_{i}-\hat{ y}_{i}\right)^{2}+\left(w_{i}-\hat{w}_{i}\right)^{2}+\left(h_{i}-\hat{h}_{i} \right)^{2}\right]\end{split}  \tag{2}\]  
\[ \begin{split} loss_{class}=&\ \lambda_{class}\sum_{i=0}^{ \sum_{j=0}^{2}}B_{i,j}^{nobj}\sum_{c\in classes}P_{i}(c)\log\left(\hat{P}_{i}( c)\right)\end{split}  \tag{3}\]  
\[ \begin{split} loss_{confidence}=&\ \lambda_{nobj}\sum_{i=0}^{ \sum_{j=0}^{2}}\sum_{j=0}^{B}1_{i,j}^{nobj}\big{(}C_{i}-\hat{C}_{i}\big{)}^{2 }\\ &+\lambda_{obj}\sum_{i=0}^{\sum_{j=0}^{2}}\sum_{j=0}^{B}1_{i,j}^ {obj}\big{(}C_{i}-\hat{C}_{i}\big{)}^{2}\end{split}  \tag{4}\]  
The loss is divided into three parts, \(loss_{wh}\) (Equation (2)) is the loss caused by the location of the predicted bounding box, \(loss_{class}\) (Equation (3)) is the loss caused by the prediction object category, and \(loss_{confidence}\) (Equation (4)) is the loss of confidence. (x, y) is the center coordinate and (w, h) is the width and height of the predicted bounding box. S is grid size; \(S^{2}\) is defined as the number of grids; B is defined as the number of prediction boxes in each cell; C is defined as the confidence of the prediction box; P is defined as the confidence of the pedestrian [56]; \(1_{ij}^{obj}\) equals 1 if the box at (i, j) has an object; \(1_{ij}^{nobj}\) equals 1 if the box at (i, j) does not have an object; \(\left(\hat{x},\hat{y},\hat{w},\hat{h},\hat{C},\hat{P}\right)\) are the values to be predicted by the network. For \(loss_{wh}\) and \(loss_{confidence}\), the sum-squared error is used as the loss function of location prediction and confidence prediction, and \(loss_{class}\) uses mean squared error as the loss function probability of category. The IOU error loss function and the classification error loss function are calculated in the YOLO algorithm utilizing binary classification cross-entropy [57]. Figure 6 depicts the overall flow chart of the enhanced YOLO-Tiny object detection algorithm described in this paper. Using the VaryBlock module, feature extraction and object detection are both completed using a convolutional neural network using the YOLO-Tiny series network as the backbone network. The input image is segmented into grids in \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Width** & 21 & 25 & 41 & 61 & 89 & 56 \\ \hline
**Height** & 30 & 53 & 37 & 75 & 63 & 105 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: The size of the generated set of preset bounding boxes. the prediction stage, and item prediction and categorization location are achieved using continuous regression of the predefined border box. The model's output is a collection of anticipated bounding boxes, each of which contains information on the object's placement inside the image and the model's level of confidence in it. As a result, we choose the box with the highest confidence among these anticipated bounding boxes. Anchors are continuously generated during the detection stage in our proposed model to discover possible object regions on the input image. The bounding box is then subjected to regression and classification. Finally, the model outputs the bounding box position as well as the object's class probability. The flow of the program is shown in Algorithm 2. ```
Input: Image X and model weight M. Output: The prediction category and probability P of all objects in image X as well as the corresponding bounding box position.