## 3 Methodology
### Context Collaboration Network (CC-Net)  
Atrous convolution can effectively expand the receptive field by using dilated convolutional kernels [42], thereby capturing multiscale information. Based on this, ASPP uses multiple parallel dilated convolutional branches with different dilation rates to extract feature maps and then fuse multiscale features. This multibranch structure can efficiently encode multiscale contexts to improve segmentation performance [43]. Self-attention mechanisms compute correlations between different positions in a sequence to achieve self-attention and context modeling. It can effectively capture long-range dependencies and provide global contextual clues [44]. The structure of our context collaboration network (CC-Net) is illustrated in Figure 5.  
CC-Net organically integrates ASPP and Self-Attention. ASPP obtains multiscale feature expressions, and self-attention encodes global contexts and models positional relationships, complementing each other to form a context-collaborative structure. In the decoder, the self-attention features of the encoder output are inputted through skip connections, passing rich global context and localization information. In addition, CC-Net uses channel attention to focus on relevant semantic features. This structure considers both localization information and multiscale features, which can accurately segment buildings in remote sensing images. Through end-to-end training, the multiscale features of ASPP, the global context modeling and positioning information of self-attention, and the collaborative connection between them enable CC-Net to form an efficient building segmentation network with strong capabilities in complex scene understanding, achieving excellent localization and multiscale capabilities.  
Figure 4: Structure of an AG module.  
Figure 5: Structure of the CC-Net module. (**a**) Atrous Spatial Pyramid Pooling (ASPP). (**b**) Self-Attention.  
The convolutional feature maps are generated as the output from the Block5 section of the encoder, and these maps serve as the input for the atrous spatial pyramid pooling. The ASPP module contains 4 parallel branches using dilated convolutions with different dilation rates (1, 6, 12, 18) to obtain feature information at different scales. The 4 groups of feature maps after 1 \(\times\) 1 convolution are concatenated to obtain feature expressions sensitive to multiscale features. The SA module contains query, key, and value 1 \(\times\) 1 convolutions to generate query, key, and value feature maps. The attention map is generated by calculating the correlations between the query and key feature maps. Then, the value feature map is weighted by the attention map to obtain a new feature map fused with global context information. Finally, the CAM unit reweights the feature channels. The multiscale feature maps provided by ASPP are input into the SA module to fuse global context information. The output of SA will contain rich localization and multiscale features. By extracting multiscale features through ASPP and providing global context and localization information through SA, the combination and connection of the two in the encoder-decoder structure enable CC-Net to consider both localization information and integrate multiscale features, achieving excellent effects in segmenting buildings in complex rural scenes.