# A Novel Deep Learning Network Model for Extracting Lake Water Bodies from Remote Sensing Images
## 2 Materials and Methods
### R50A3-LWBENet Model Components
#### 2.2.3 Convolutional Block Attention Module (CBAM)  
CBAM is to merge the channel attention mechanism and the spatial attention mechanism in one piece to realize a sequential self-attention structure from channel to space [29]. Channel attention is used to handle the allocation relationship of feature mapping channels while allocating attention to multiple dimensions, thus enhancing the effect of the attention mechanism on the improvement of model performance. The spatial attention mechanism allows the network model to pay more attention to the pixel regions that play a decisive role in image segmentation and ignore irrelevant regions [30]. The feature map goes through the channel attention mechanism module and then the spatial attention mechanism module. The structure of the channel attention mechanism module is shown in Figure 3.  
Figure 1: Lake water body study area.  
The input feature map \(F(C\times H\times W)\) is changed to the size of (\(C\times 1\times 1\)) after passing through two parallel global maximum pooling (MaxPool) layer and global average pooling (AvgPool) layer, then passes through the shared MLP Layer, in which it first compresses the number of channels to \(1/r\) of the original one (\(r=16\)), then expands to the original number of channels, and passes through the ReLU activation function layer to get two activated feature matrices, these two output feature matrices are summed, and then through a Sigmoid activation function layer to get the attention weights \(M_{C}\) of each channel, and then multiply \(M_{C}\) with \(F\) to get the feature map \(M_{C}(F)(C\times H\times W)\) that gives the channel attention. The channel attention mechanism can be expressed as Equation (1).  
\[M_{C}(F)=\sigma(MLP(AvgPool(F))+MLP(MaxPool(F)))=\sigma(W_{1}(W_{0}(F_{avg}^{C }))+W_{1}(W_{0}(F_{\text{max}}^{C})) \tag{1}\]  
where \(\sigma\) is the Sigmoid activation function, \(W_{0}\) is the fully connected hidden layer weight, and \(W_{1}\) is the fully connected output layer weight. After that the feature map output from the channel attention mechanism module is then passed through the spatial attention mechanism module. The structure of the spatial attention mechanism module is shown in Figure 4.  
Figure 3: The structure of the channel attention mechanism module.  
Figure 2: SE-ResNet network structure (**a**) the original ResNet residual module (**b**) the SE-ResNet residual module.  
Firstly, the channel refined feature \(F\), i.e., \(M_{\text{C}}(F)\), is passed through the MaxPool layer and AvgPool layer to get two feature maps with the size of (\(1\times H\times W\)), and secondly, the two feature maps are concatenated, and then it is changed into 1-channel feature map through the convolutional layer with convolutional kernel of the size of (\(7\times 7\)), and then it is passed through a Sigmoid activation function to get the spatial attention weights \(M_{S}\) for each pixel point, and finally the \(M_{S}\) is multiplied by \(M_{C}(F)\) to obtain the feature map \(M_{S}(F)(C\times H\times W)\) endowed with spatial attention. The spatial attention mechanism can be expressed as Equation (2).  
\[M_{S}(F)=\sigma(f^{\gamma\times 7}([AvgPool(F);MaxPool(F)])=\sigma(f^{\gamma \times 7}([F^{S}_{avg};F^{S}_{\text{max}}])) \tag{2}\]  
where \(\sigma\) is the Sigmoid activation function and \(f^{\gamma\times 7}\) is a convolutional layer with a convolutional kernel size of (\(7\times 7\)).  
The CBAM module is able to derive the attention map sequentially along the two independent dimensions of channel and space with a very small amount of computation, carry out adaptive feature refinement, and suppress the noise interference, so as to realize adaptive extraction of water body features [31]. The structure of the CBAM module is shown in Figure 5.