# A Real-Time Safety Helmet Wearing Detection Approach Based on CSYOLOv3
## 3 Cross Stage YOLOv3 (CSYOLOv3) Model
### Feature Enhancement Network  
Spatial pyramid pooling (SPP) is a model raised by [PERSON] et al. [25] to address the problem with regard to the input images with different sizes of the neural networks. Its main idea is to splice feature maps of arbitrary size into a fixed length feature vector through multi-scale pooling operation. Different from the purpose of [PERSON] et al., the SPP structure is introduced in this paper in order to further obtain multi-scale local feature information. Thus it is fused with the global feature information to obtain more abundant feature representation, thereby improving the prediction accuracy. Due to a series operations of convolution and down-sampling, the global semantic information of CSPDarknet53 is very rich. Therefore, in order to obtain more local features, the SPP structure is added into the convolution of the last feature layer in CSPDarknet53, which is shown in Figure 3.  
It can be seen from Figure 3 that the specific steps of the improved SPP network structure are as follows: Firstly, the network structure of \(13\times 13\) feature layer is convoluted for three times, and then three different scale pooling layers are used for maximum pooling, of which the pooling kernel size is \(13\times 13\), \(9\times 9\) and \(5\times 5\), while the stride is \(1\). Finally, the input global feature maps and the three local feature maps after pooling are stacked, then three times convolution followed. The use of SPP structure can greatly strengthen the receptive field of the last feature layer, separate the most significant context features to obtain more abundant local feature information. Considering that the details and location information of low-level feature layer are generally rich, however, with the deepening of feature layers, the detail information is decreasing, while the semantic information is increasing. Thus, the higher the feature layer is, the richer the contained semantic information will be. After the SPP structure is added into the CSPDarknet53, the multi-scale prediction network is improved by combining the feature fusion strategy, from which feature representation is enhanced through top-down and bottom-up fusion strategies [28] to further realize feature reuse. The structure of the improved multi-scale prediction network is expressed in Figure 4.  
As can be seen from Figure 4, the specific improvements of the multi-scale prediction structure in this paper are: Firstly, three effective feature layers are extracted from the CSPDarknet53 backbone, which are respectively recorded as Large Feature Layer (LFL), Medium Feature Layer (MFL) and Small Feature Layer (SFL); Secondly, SFL0 is then convoluted three times, and the spatial pyramid pooling is performed so as to obtain SFL1, MFL1 is obtained by fusing the results of SFL1 that performing once convolution and upsampling with that of MFL0, and then LFL1 is obtained by fusing the results of MFL1 that executing once convolution and up-sampling with the result of LFL0 that only executing once convolution, so as to complete the feature fusion from bottom to top. Afterwards, FLF2 is achieved by five times convolution for LFL1, in order to get MFL2 by fusing the result of LFL2 that performing once downsampling with the result of MFL1 that executing five convolutions. Then, MFL2 is further downsampled, of which the result is fused with SFL1 to get SFL2, thus completing the feature fusion from top to bottom. Finally, LFL2, MFL2 and SFL2 are obtained by fusing the three initial effective feature layers LFL0, MFL0 and SFL0 by bottom-up and top-down fusion, which are input into YOLO Head for prediction after five convolutions. Among them, conv_1 represents a convolution with the size of \(1\times 1\). It can be seen from Figure 4 that the multi-scale prediction network is improved by using the top-down and bottom-up feature fusion strategies. While the computational complexity is added to a certain extent, the prediction accuracy has been significantly improved.