# A Dense Small Object Detection Algorithm Based on a Global Normalization Attention Mechanism
## 2 GNYL (Global Normalization Attention Mechanism You Only Look Once)
### Global Normalization Attention Mechanism  
The design principle of the GNAM is to fully exploit the information in the input features while adding minimal network parameters and floating-point computations. This ensures the applicability of the plug-and-play GNAM attention module to different target detection networks and maintains the real-time performance of the object detection algorithm. The overall process of the GNAM is to input features using a channel attention unit, which utilizes scale factors from batch normalization (BN) to highlight features based on the variance measurement of the training model weights, and then inputs them into a spatial attention unit, which incorporates spatial information using two convolutional layers, further emphasizing the spatial information. The interaction ability between the channel and spatial information is improved, fully exploits effective information for classification and localization tasks within the input features, and enhances the richness of detail in the GNAM's output features. The overall structure is shown in the Figure 2.  
Assuming the input features \(X\) to the GNAM where \(X=[x_{1},x_{2},\cdots,x_{c}]eR^{C\times H\times W}\), they are passed through the channel attention unit, as shown in Figure 3. This paper adopts a scaling factor from batch normalization (BN), as shown in Equation (1). The scaling factor measures the variance of channels and indicates their importance. \[B_{out}=BN(B_{in})=\gamma\frac{B_{in}-\mu_{B}}{\sqrt{\sigma_{B}^{2}+\epsilon}}+\beta \tag{1}\]  
where \(\mu_{B}\) and \(\sigma_{B}\) are the mean and standard deviation of mini-batch \(B\), respectively, and \(\gamma\) and \(\beta\) are the trainable affine transformation parameters (scale and shift) [17]. The channel attention unit is shown in Figure 3 and Equation (2). Batch normalization is performed on the input features, and the trainable weight applies to the results of batch normalization. Figure 1: GNAM network structure diagram. “*” represents a multiplication sign. Figure 2: Global Normalization Attention Module structure diagram. Then, the output feature \(M_{c}\) is obtained from the above results using the activation function. \[M_{c}=F_{sigmoid}(W_{\gamma}(F_{BN}(X))) \tag{2}\]  
where \(F_{BN}\) is batch normalization; \(\gamma\) is the scaling factor for each channel; the weights are obtained as \(W_{\gamma}=\gamma_{i}/\sum_{j=0}\gamma_{j}\); and \(F_{sigmoid}\) is the sigmoid activation function. In order to extract channel information while retaining more feature information, the output features of the channel attention unit are fused with the input features, achieving the goal of fully exploiting the effective information within the input features, as shown in Equation (3). \[M=M_{c}\cdot X \tag{3}\]  
In order to mine the spatial attention information, the input features \(M\) are passed through the spatial attention unit. The spatial attention unit without group convolution is shown in Figure 4. In this module, to concentrate on the spatial information, this paper adopts two 7 \(\times\) 7 convolution layers for spatial information fusion. The 7 \(\times\) 7 convolution layer has a larger receptive field that can cover a larger input feature region and provide more feature representations and better robustness, thus fully utilizing the spatial information of the features. This paper also adopts the same reduction ratio \(r\) as BAM [18]. Meanwhile, the max pooling layer significantly reduces the information, and contributes. This paper removes the pooling layer to preserve the features further. As a result, the spatial attention unit significantly increases the number of parameters. To prevent a notable increase in the parameters, this paper adopts group convolution with channel shuffling [19]; the output feature Y is obtained, as shown in Equation (6).