# ADSSD: Improved Single-Shot Detector with Attention Mechanism and Dilated Convolution
## 3 Method
### Adssd
#### 3.2.1 Residual Convolutional Block Attention Module  
The attention mechanism can be widely understood as focusing only on local information to suppress redundant information on detection. There are currently three categories of attention mechanisms. They are spatial, channel, and mixed attention mechanisms.  
The CBAM combines the advantages of spatial and channel attention mechanisms. In Figure 3, we can see the general structure of the CBAM. It serializes spatial attention and channel attention while emphasizing meaningful features in both spatial and channel dimensions.  
Figure 1: Network of Single-Shot MultiBox Detector (SSD).  
Figure 2: The single-shot object detection with attention mechanism and dilated convolution (ADSSD).  
Taking \(F\in R^{C\times H\times W}\) as input, CBAM yields in order \(M_{C}\in R^{C\times 1\times 1}\) and \(M_{s}\in R^{1\times H\times W}\) as illustrated in Figure 3. The entire attention process can be described as:  
\[F^{\prime}=M_{C}(F)\otimes F \tag{1}\]  
\[F^{\prime\prime}=M_{s}\big{(}F^{\prime}\big{)}\otimes F^{\prime} \tag{2}\]  
where \(\otimes\) denotes element-wise multiplication.  
In Figure 4, the channel attention module establishes connections between channels by squeezing the spatial dimension of the feature map.  
In the following formula, \(F^{c}_{avg}\) and \(F^{c}_{max}\) represent the feature maps after average-pooling and max-pooling. The channel attention is computed as:  
\[\begin{array}{ll}M_{C}(F)&=\sigma(MLP(AvgPool(F))+MLP(MaxPool(F)))\\ &=\sigma\Big{(}W_{1}\Big{(}W_{0}\Big{(}F^{c}_{avg}\Big{)}\Big{)}+W_{1}(W_{0}(F^ {c}_{max}))\Big{)}\end{array} \tag{3}\]  
where \(\sigma\) means the sigmoid function, \(W_{0}\in R^{C/r\times C}\), and \(W_{1}\in R^{C\times C/r}\).  
In addition, as shown in Figure 5, we obtain spatial attention by applying pooling operations along the channel axis.  
Figure 4: The channel attention module of CBAM. Channel attention map \(M_{C}\) is generated by feeding the pooled feature maps into a shared network.  
Figure 5: The spatial attention module of CBAM. Spatial attention map \(M_{s}\) is generated by pooling operations on the feature map.  
Figure 3: An overview of Convolutional Block Attention Module (CBAM). The module has two sequential sub-modules: channel and spatial attention modules.  
The spatial attention module uses \(F^{\text{s}}_{avg}\in R^{1\times H\times W}\) and \(F^{\text{s}}_{max}\in R^{1\times H\times W}\) to represent the feature maps after pooling operations along the channel axis. The spatial attention is computed as:  
\[\begin{split} M_{\text{s}}(F)&=\sigma\big{(}f^{ \gamma\times 7}([AvgPool(F);MaxPool(F)])\big{)}\\ &=\sigma\Big{(}f^{\gamma\times 7}\Big{(}\big{[}F^{\text{s}}_{avg};F ^{\text{s}}_{\text{max}}\big{]}\Big{)}\Big{)}\end{split} \tag{4}\]  
where \(f^{\gamma\times 7}\) represents a convolution operation with the filter size of \(7\times 7\).  
By reading many papers, we found that no one has yet introduced a CBAM on an SSD. Therefore, to improve the performance, we introduced the improved CBAM. Inspired by [PERSON] et al. (2020), we chose to build a residual CBAM. This module makes a skip connection between the input and output layer. This improvement can effectively alleviate the problem of network degradation and speed up training.  
Unlike others, we inserted the module into the backbone network. This method can improve detection accuracy without slowing down the detection speed. The specific structure of the residual CBAM is shown in Figure 6.  
In the next section, we will introduce another module we built called a multi-branch dilated convolution module (MDCM).