## 3 Materials and Methods
### ShadeNet: A Novel Approach to High-Precision Shade House Extraction
#### 3.2.2 Backbone of ShadeNet: Swin Transformer  
In existing research on the extraction of APCs, most semantic segmentation methods rely on CNN architectures, such as FCN [39], U-Net [27], etc. A few studies adopt Transformer architectures, often combined with U-Net [27], ResNet [40], etc., as backbone networks for feature extraction. However, CNNs have limitations in handling images due to their restricted receptive fields, while the earlier proposed Vision Transformer (ViT) [41] network faces the issue of insufficient information sharing between windows. To overcome these challenges, this study innovatively proposes using the Swin Transformer [17] as the backbone and combining it with the Mask2 Former architecture [18] for the APC extraction task, aiming to enhance the model's ability to learn global context information. Experimental results show that the network based on Swin Transformer [17] and Mask2 Former [18] exhibits significant performance improvement in shade house extraction tasks, particularly in fine-grained image segmentation and global information integration, demonstrating its potential and advantages in high-precision remote sensing image segmentation tasks. The Swin Transformer [17] is responsible for feature extraction, and this section will provide a detailed introduction to its structure, as used in our study. An overview of the Swin Transformer [17] architecture is presented in Figure 7. The process begins by splitting the input image into non-overlapping patches using the patch partition module. Each patch is treated as a \"token\", and its feature is represented as a concatenation of the raw pixel RGB values. In this implementation, the patch size is 4 \(\times\) 4, and each patch has a feature dimension of 4 \(\times\) 4 \(\times\) 3 = 48. A linear embedding layer was applied on this raw-valued feature to project it to an arbitrary dimension (denoted as C). The first stage involves passing these patch tokens through several Swin Transformer blocks, with the number of tokens maintained as H/4 \(\times\) W/4. This stage, referred to as Stage 1, incorporates the linear embedding and Transformer blocks. To produce a hierarchical representation, the number of tokens is reduced by Patch Merging layers as the network deepens. The first patch merging layer concatenates the features of each group of 2 \(\times\) 2 neighboring patches, applying a linear layer on the 4C-dimensional concatenated features. This reduces the number of tokens by a factor of 2 \(\times\) 2 = 4, with a 2\(\times\) downsampling of resolution, and the output dimension is set to 2C. The resulting feature map undergoes additional transformations through the Swin Transformer Blocks. This process, labeled as Stage 2, keeps the resolution at H/8 \(\times\) W/8. This procedure is repeated in Stage 3 and Stage 4, where the output resolutions are H/16 \(\times\) W/16 and H/32 \(\times\) W/32, respectively. The Swin Transformer [17] adopts a hierarchical structure, enabling it to process images at multiple scales and resolutions. The outputs at different stages represent features at various scales, capturing both local and global information from the input image. By combining or extracting features from different stages, a feature pyramid is formed. This process involves obtaining features from multiple levels to create a set of multi-scale features. The feature pyramid is crucial for capturing information at different levels of abstraction, allowing the model to handle objects of varying sizes in the input image. To address the challenges faced by the original ViT [41], the Swin Transformer [17] introduces two fundamental concepts: shifted window attention and hierarchical feature maps. In fact, the term \"Swin Transformer\" is derived from the \"Shifted Window Transformer\" concept. The shifted window attention mechanism enhances the interaction between windows by adjusting their positions, alleviating the issue of insufficient information sharing.