# EAAnet: Efficient Attention and Aggregation Network for Crowd Person Detection
## 2 Model and Method
### Model Description
#### 2.2.1 CBAM Attention Mechanism  
Traditional attention mechanism mainly emphasizes the extraction of channel information and is limited by the interaction between channels. However, CBAM [19] introduces SA and CA, implementing a sequential structure from the individual channel level to the spatial context. SA is able to assign greater focus to individual pixels that have a significant influence on image classification. CA solves the spatial distribution of channels. The structure of the CBAM attention mechanism is shown in Figure 5. It consists of a channel attention module and a space attention module, respectively. The expression of the overall calculation process is shown in Formula (1)  
\[\begin{array}{c}\mathbf{F^{{}^{\prime}}}=\mathbf{M_{C}(F)\otimes F}\\ \mathbf{F^{{}^{\prime}}}=\mathbf{M_{S}(F^{{}^{\prime}})\otimes F^{{}^{\prime}} }\end{array} \tag{1}\]  
where \(\mathbf{F^{{}^{\prime}}}\) represents the input feature, \(\mathbf{M_{C}}\) represents channel attention output, \(\mathbf{M_{S}}\) represents space attention output, \(\otimes\) represents the multiplication of each element step by step, and \(\mathbf{F^{{}^{\prime}}}\) represents the final output of the CBAM module.  
The channel attention module first passes the input \(\mathbf{F}\) through two parallel branches, effectively fusing the output of max-pool and average-pool operation. Average pooling efficiently compresses the spatial dimension of the input feature maps, while maximum pooling focuses on capturing and emphasizing key features. The fusion results are then fed into a shared MLP (multi-layer perceptron) to construct a correlation between the two fully connected layers, and use the sigmoid activation function to obtain the weight of each feature channel \(\mathbf{M_{S}}\). Then, channel multiplication is applied to it and the original input features \(\mathbf{F}\) to realize a weighted fusion in order to finely adjust and calibrate original features in the channel dimension.  
The calculation process of channel attention in CBAM is shown in Formula (2).  
\[\mathbf{F^{{}^{\prime}}}=\mathbf{M_{C}(F)}=\sigma(\mathbf{W_{1}(W_{0}(F_{avg}^{ C}))+W_{1}(W_{0}(F_{max}^{C})))} \tag{2}\]  
where \(\sigma\) represents the _sigmoid_ activation function, \(\mathbf{W_{0}}\) and \(\mathbf{W_{1}}\) represent the sharing weight of MLP, and \(\mathbf{F_{avg}^{C}}\) and \(\mathbf{F_{max}^{C}}\) represent the average pooling result of the channel, and maximum pooling result of the channel, respectively.  
The spatial attention module weights the different spatial positions of the input to spatially enhance the important features. The output feature map \(\mathbf{F^{{}^{\prime}}}\) of the channel attention module is taken as input, and the spatial weights are learned through serial maximum  
Figure 5: The CBAM attention module.  
pooling and average pooling operations, and then applied to each spatial position on the input feature map \(\mathbf{F}^{\prime}\) to weight it. Finally, this result is processed by the sigmoid activation function to produce the final spatial attention feature map. The calculation process is shown in Formula (3).  
\[\mathbf{F}^{\prime}=\mathbf{M_{S}}\Big{(}\mathbf{F}^{\prime}\Big{)}=\sigma\Big{(} f^{7\times 7}\Big{(}\Big{[}\mathbf{F_{avg}^{S}:F_{max}^{S}\Big{]}}\Big{)}\Big{)} \tag{3}\]  
where \(f^{7\times 7}\) represents the kernel size of the convolution operation is \(7\times 7\), \(\mathbf{F_{avg}^{S}}\) and \(\mathbf{F_{max}^{S}}\) represent the results of the average and maximum pooling in spatial attention, respectively, and : represents the concatenation operation.