## 3 Improved YOLOv4-Tiny Detection Model  
### Basic Principle of YOLOv4-Tiny  
The YOLO algorithm is a popular one-stage detection algorithm. The algorithm treats the target detection problem as a regression problem. The convolution neural network structure can directly predict the location and category of the target, it runs fast, and it can achieve real-time detection. YOLOv4 [21], as one of the most advanced algorithms in the current YOLO series, is an improvement of YOLOv3 [22]. It has strong real-time performance and a high accuracy and has been widely used in practical projects. YOLOv4-tiny is a lightweight network version of YOLOv4, which simplifies the network structure and parameter quantity. Its detection accuracy is lower than that of YOLOv4 but it has a higher detection speed. It also has obvious advantages in detection speed and accuracy compared with other versions of the YOLOv4 lightweight network. Its network structure is shown in Figure 2. The research goal of this paper was to achieve the classification and detection tasks of 9 types of targets. The detection speed and accuracy of the algorithm were high. Because the target scale of construction machinery and materials is large, and the number of categories is small, it does not need too deep a convolution neural network, so we chose to improve the YOLOv4-tiny algorithm. YOLOv4-tiny uses CSP Darknet53-tiny as the backbone network, with a (416 \(\times\) 416)-size image used as input. The backbone network is mainly composed of the CBL module and CSPBlock residual module. The CBL module is composed of a common convolution layer (Conv), batch standardization (BN), and leaky ReLu activation function. The CSPBlock module divides the input features into two parts. When stacking the residual blocks, a large residual edge is introduced. Finally, the two feature maps are spliced and the combined feature maps are downsampled using maximum pooling. This structure can effectively reduce the number of calculations. After downsampling 16 times and 32 times, the high-level and low-level feature information are fused using the idea of a feature pyramid [23] to improve the network-free feature extraction ability, and the final output size is \(13\times 13\) and \(26\times 26\) for the target detection. The YOLOv4-tiny algorithm first extracts the features of the input image through the feature extraction network and then divides it into \(\mathsf{S}\times\mathsf{S}\) grid cells. If the center point of a target falls in the grid cell, the grid is responsible for predicting the target. Each grid cell needs to predict three boundary boxes. Each boundary box contains information on four positions, \(x\), \(y\), \(w\), and \(h\), as well as the confidence and probability of a category. Multiple grid cells may predict the same target, Therefore the results are filtered using non-maximum suppression to get the coordinates and categories of the detected targets. YOLOv4-tiny's loss function refers to the difference between the predicted value of the model and the real value. The smaller the value of the loss function, the higher the prediction accuracy and the better the robustness of the model. YOLOv4-tiny's loss function  
Figure 2: YOLOv4-tiny algorithm network structure. includes three parts, namely, the position loss, the confidence loss, and the category loss. The loss function is shown in Equation (15). \[\text{Loss }=L_{\text{CIOU}}+L_{\text{conf}}+L_{cls} \tag{15}\]  
\[L_{CIOU}=\lambda_{coord}\sum\limits_{i=0}^{K\times K}\sum\limits_{j=0}^{M}l_{ij }^{obj}(2-w_{i}\times h_{i})(1-CIOU) \tag{16}\]  
\[CIOU=IOU-\frac{\rho^{2}(b,b^{st})}{c^{2}}-\beta v \tag{17}\]  
\[\beta=\frac{v}{1-IOU+v} \tag{18}\]  
\[v=\frac{4}{\pi^{2}}\left(\arctan\frac{w^{st}}{h^{st}}-\arctan\frac{w}{h} \right)^{2} \tag{19}\]  
\[