## 3 Improved YOLOv4-Tiny Detection Model
### Improved YOLOv4-Tiny Algorithm  
Because the detection algorithm in this paper was aimed at the detection and classification of construction machinery and materials, the target scale changed little, the category was small and had obvious characteristic information. The deep convolution neural network model had too many parameters and a long training time, which was not suitable for this project. Therefore, we chose to improve YOLOv4-tiny, a lightweight model, in order to achieve a higher detection accuracy under the condition of ensuring a faster detection speed. The improved YOLOv4-tiny in this paper added a channel attention SE module [24] and a spatial pyramid pooling module to the original network and improved the FPN feature fusion part of the network. The details are as follows: (1) At the neck of the network structure, this paper added an SPP module [25]. The SPP module is composed of four parallel branches, each with a convolution core size of 5 \(\times\) 5, 9 \(\times\) 9, 13 \(\times\) 13, and a jump connection. Finally, the feature maps of the four branches are spliced and transferred to the next layer. The SPP module draws on the idea of the spatial pyramid, which enables the convolutional neural network to input images of arbitrary size, use different sliding window sizes and step sizes for different output scales, and finally output a fixed-length vector, realizing the fusion of local features and global features. Moreover, the fused feature map contains different levels of semantic information, which is conducive to improving the abstract expression of features and enhancing the sensitivity of features to high-level semantic concepts. (2) To make the detection network have higher accuracy, we inserted a channel attention mechanism SE module between the backbone feature extraction network and the feature fusion network. The SE module first performs a squeeze operation through a global average pooling to compress the input feature map of each channel into a scalar. This process can be regarded as feature extraction for each channel to obtain the importance of the channel. Then, the squeezed feature vector is input into two fully connected layers through the excitation operation. One fully connected layer is used to learn the weights between channels, and the other fully connected layer is used to learn the activation function. Then, the outputs of the two fully connected layers are multiplied to obtain a channel attention vector. Finally, the channel attention vector is applied to the input feature map to enhance useful features and weaken useless features. Its main advantages are that it can adaptively adjust the weight of each channel so that useful features get a higher weight and useless features get a lower weight, thereby improving the accuracy and robustness of the model. It can effectively improve the accuracy of the target detection with a small increase in the number of parameters. (3) In YOLOv4-tiny, the main role of the FPN structure is to solve the multiscale target detection problem in target detection by extracting multiscale features from different levels of feature maps, so that targets of different sizes can be detected. To be able to better fuse the features of different scales, we redesigned the FPN multiscale feature fusion structure. In the original structure, the multiscale features were fused only once. In this algorithm, we used a top-down and bottom-up bidirectional fusion based on the original fusion, using upsampling and downsampling to unify the features to the same size and adding jump connections between same-scale feature maps to realize the fusion of higher-level feature maps with lower-level feature maps, so that the information in the lower-level feature maps can be reused. This improved the utilization of multiscale features, enriched the information in the feature map, and improved the accuracy and robustness of the model.