# A Multi-Path Semantic Segmentation Network Based on Convolutional Attention Guidance
## 3 Method
### Multi-Path and Attention-Guided Fusion Module
For the DP, due to its low number of stacked convolutional layers and small kernel sizes, the main path guides its feature extraction at high resolution, allowing it to selectively learn higher-level semantics. Specifically, the main path's output from each stage starting from stage two is combined with the corresponding output of the DP and then fed into the AGFM module (attention-guided fusion module). The schematic diagram of this module is shown in Figure 5, where \"dp\" represents the features from the DP; \"mp\" represents the features from the main path; \"S\" represents the combination operation of \(sum\) and \(Sigmoid\); \(\otimes\) denotes element-wise multiplication, which is the weight allocation; and \(\oplus\) denotes element-wise summation. The main path's high-level semantic information is selectively incorporated into the pathway, and the DP retains a significant amount of high-quality detailed information that ultimately enhances the segmentation results. The lateral connections used in [26; 27; 28] strengthen the information flow between feature maps of different scales, improving the model's representational capacity. In the AGFM, the outputs of the DP and the main path, both passed through convolutional blocks and channel expansion, are adjusted to the same resolution. Denoting these as \(dp\) and \(mp\), the output of the \(Sigmoid\) function can be expressed as Equation (13):  
\[S=Sigmoid(sum(dp\otimes mp)) \tag{13}\]  
where the computed result \(S\) indicates the likelihood of these two pixels belonging to the same object class, \(sum\) represents the summation along the channel dimension and \(\otimes\) denotes element-wise multiplication. When \(S\) is higher, there is reason to trust the results from the main path since it provides rich and accurate semantics, and vice versa. After obtaining \(S\), we adjust the number of channels and resolution of the main path to match those of the DP and perform the final addition. Thus, the output of the AGFM module can be written as Equation (14):  
\[Out_{AGFM}=S\otimes mp+(1-S)\otimes dp \tag{14}\]  
Therefore, in the case of deeper feature extraction, the main path can leverage higher semantic information to guide the DP in selectively learning better semantic information while preserving detailed information, ultimately optimizing the segmentation results. For the BP, at the end of each stage, the output of the main path is directly added to the output of the BP after adjusting the number of channels and the resolution. This integrates global information and focuses on boundary information using the output features of the main path (MP). To construct a better global scene prior, PSPNet introduces a pyramid pooling module (PPM), concatenating multi-scale pooled representations before the convolution layers to capture both local and global contexts. In MCAG, after the last stage of the main path, the output is fed into a parallel fusion module (PFM) to prepare for the fusion of the final three paths. This parallel fusion module enhances the context embedding capability, forming a fusion of local and global contexts to analyze global correlations. PFM processes the output of the last stage of the main path in parallel through four pooling paths, with kernel sizes of 5, 9 and 17 for the first three paths and global average pooling for the last path. It then passes through BN and ReLU layers, followed by a convolutional layer that doubles the number of channels and concatenates the results. Finally, a residual connection is established with the input features of PFM to obtain the final output of PFM, as expressed in Equations (15) and (16):  
\[P=\sum_{i=0}^{3}Pooling_{i}(input) \tag{15}\]  
\[Out_{PFM}=input+Cat(Conv(P)) \tag{16}\]  
where \(input\) represents the input to the PFM; \(Pooling_{i}\) represents the four pooling paths; \(Conv\) represents the combined operation of convolution, normalization and activation; and \(Cat\) denotes the concatenation operation.