## 3 Methodology
### D-Cbam  
While CNNs adeptly discern local features and spatial information via convolutional operations, they also address certain Transformer limitations, such as accuracy in localization and extraction of local features. During network training, prioritizing more salient features is desirable, making the integration of an attention mechanism within convolutional operations a potent strategy [35; 36]. CBAM, a streamlined attention module, sequentially employs channel and spatial attention, effectively interpreting channel and spatial information within feature maps. To enhance the expressive capacity of the convolutional attention module, the study introduces an advanced form of CBAM, termed D-CBAM, which optimizes the original structure. The architecture of D-CBAM is depicted in Figure 6. The structure of D-CBAM is shown in Figure 6.  
Channel attention facilitates the allocation of distinct attention levels to different channels at each position within an image, as delineated in Equation (1):  
\[M_{c}(F)=\sigma(MLP(AvgPool(F))+MLP(MaxPool(F))) \tag{1}\]  
where \(M_{c}\) denotes the channel attention map; \(\sigma\) denotes the Sigmoid function; \(MLP\) denotes the multi-layer perceptron; \(MaxPool\) denotes the global maximum pooling; \(AvgPool\) denotes the global average pooling.  
The deformable convolutional layer, with its inherent ability to learn offsets, can dynamically alter the shape and size of the receptive field in accordance with the specific characteristics of water bodies within an image. This advanced feature substantially augments the network's proficiency in pinpointing the accurate spatial attributes of water bodies. Consequently, this study introduces an enhancement to the spatial attention module  
Figure 6: Structure of D-CBAM.  
within CBAM by substituting traditional convolution, which conducts sampling of a fixed size and is thus termed regular convolution, with deformable convolution. Deformable convolution distinguishes itself by incorporating a learnable offset for each sampling point within the receptive field, providing a more adaptable approach to feature extraction [37]. The mathematical representation of deformable convolution is articulated in Equation (2):  
\[y(p_{0})=\sum\
olimits_{p_{n}\in\mathbb{R}}w(p_{n})\times x(p_{0}+p_{n}+\Delta p _{n}) \tag{2}\]  
where \(w(p_{n})\) denotes Convolution checks the weight of the position; \(\Delta p_{n}\) denotes offsets; \(x(p_{0}+p_{n}+\Delta p_{n})\) denotes the offset element value at \(p_{0}+p_{n}\) position on the input feature map.  
In the enhanced spatial attention module, feature set \(\mathbb{F}^{\prime}\), refined by the channel attention mechanism, undergoes global average pooling and max pooling. These procedures, executed across the channel dimension, convert \(\mathbb{F}^{\prime}\), originally with dimensions \(\mathbb{H}\times W\times\mathbb{C}\), into two feature tensors, each with dimensions \(1\times 1\times\mathbb{C}\). These tensors are then concatenated along the channel dimension, resulting in a single \(1\times 1\times 2\mathbb{C}\) feature tensor. This tensor is subsequently processed through a \(3\times 3\) deformable convolutional layer, emphasizing the adaptability to the image's spatial characteristics. The Sigmoid activation function is then applied to this convoluted output, yielding weight matrices that signify the relative importance of various spatial components within the image. These weight matrices are element-wise multiplied with the original feature set \(\mathbb{F}^{\prime}\), assigning distinctive weights to different spatial elements in the image. This process is mathematically captured in Equation (3), with the deformable convolution-based spatial attention module illustrated in Figure 7:  
\[M_{\text{s}}(F)=\sigma\Big{(}f_{d}^{3\times 3}([AvgPool(F);MaxPool(F)])\Big{)} \tag{3}\]