# Weak Edge Target Segmentation Network Based on Dual Attention Mechanism
## 2 Theoretical Basis
### Attention Mechanism  
The attention mechanism is a critical technique in deep learning that allows models to adaptively focus on key parts of input data, enhancing performance and generalization capabilities [29; 30]. Widely used in computer vision tasks like image classification, object detection, and semantic segmentation, this section will introduce the attention mechanism from different perspectives, including channel attention, spatial attention, hybrid attention, and self-attention mechanisms.  
The channel attention mechanism adjusts the weights of different channels by learning their importance, adaptively enhancing crucial features while suppressing minor ones [31]. The Squeeze-and-Excitation Networks (SENet) represent a typical channel attention mechanism [32]. By incorporating SE modules, SENet adjusts the weights of each channel in convolutional networks. The SE module first conducts global average pooling on input feature maps, then utilizes two fully connected layers to learn channel weights, and finally applies these learned weights to the original feature map to adjust channel importance. The channel attention mechanism effectively boosts model expressiveness, leading to significant performance improvements in tasks such as image classification.  
The spatial attention mechanism adjusts the weights of different spatial positions by learning their importance, highlighting target areas while suppressing background interference [33]. The spatial attention module generates spatial weight maps of the same size as the input feature map using convolutional layers and the Sigmoid function. These weight maps are then applied to the original feature map to adjust the importance of spatial positions. The spatial attention mechanism effectively increases the model's focus on target regions, achieving good results in tasks like object detection and semantic segmentation.  
The hybrid attention mechanism combines channel attention and spatial attention, adaptively adjusting the weights of both the channel and spatial dimensions of feature maps [34]. CBAM, in addition to incorporating a spatial attention module, also introduces a channel attention module [35]. By concatenating these two modules, CBAM achieves a joint attention mechanism across channel and spatial dimensions. The hybrid attention mechanism comprehensively explores critical information in feature maps, further enhancing model performance.  
The self-attention mechanism models long-range dependencies by computing the correlations between different positions in the feature map [36]. Non-local neural networks represent a typical self-attention mechanism. By calculating the similarity between all positions in the feature map, generating attention weights, and aggregating the weighted features, non-local neural networks fuse global contextual information. The self-attention mechanism effectively captures long-range dependencies in feature maps, leading to significant performance improvements in tasks like video classification and action recognition. Moreover, the multi-head self-attention mechanism in Transformers has been widely applied in computer vision tasks, such as vision Transformer models like ViT, driving further advancements of self-attention mechanisms in the field of computer vision.  
The introduction of attention mechanisms significantly enhances the expressive power and generalization capabilities of deep learning models, enabling models to adaptively focus on key information in input data and suppress interfering factors. By appropriately designing and applying attention mechanisms, performance in computer vision tasks can be further improved, driving advancements in related fields.