## 3 Materials and Methods
### ShadeNet: A Novel Approach to High-Precision Shade House Extraction
#### 3.2.2 Backbone of ShadeNet: Swin Transformer
Finally, the reverse permutation was performed to restore the original dimensions (\(\text{C}\times\text{H}\times\text{W}\)), and the input feature map multiplied with the channel attention map element-wise to obtain the enhanced feature map. The formula representing this process is as that in (1), where \(\text{F}_{\text{channel}}\) represents the enhanced feature map, \(\sigma\) denotes the Sigmoid function, \(\odot\) indicates element-wise multiplication, \(\text{F}_{\text{input}}\) refers to the original input feature map. \[\text{F}_{\text{channel}}=\text{Permute}^{-1}\left(\sigma\left(\text{MLP }\left(\text{Permute}\left(\text{F}_{\text{input}}\right)\right)\right) \right)\odot\text{F}_{\text{input}} \tag{1}\]  
Local-Spatial Attention Submodule: Channel attention alone may not fully exploit spatial information, which is equally crucial for capturing both local and global features in the image. Without considering spatial dimension information, the model may overlook important details in the feature map. In the spatial attention submodule, we process spatial information using two \(7\times 7\) convolutional layers. The input feature map first undergoes a \(7\times 7\) convolutional operation, reducing the number of channels to 1/r of the original. The variable r (the r variable in Figure 9) is used to control the reduction ratio of the number of channels in the spatial attention submodule. Specifically, r determines the reduction and restoration of the number of channels during the convolution operation. By adjusting the value of r, the computational cost and the number of parameters can be effectively reduced while maintaining model performance, thereby improving the efficiency of the model. This is followed by batch normalization and a ReLU activation function for non-linear transformation. The second \(7\times 7\) convolutional layer restores the channel number to its original dimension, followed by another batch normalization layer. This approach helps capture the dependencies in the spatial dimension more effectively. Finally, a spatial attention map is generated using the Sigmoid activation function. The channel attention map and spatial attention map are then element-wise multiplied to produce the final output feature map. The formula representing this process is as that in (2), where \(\text{F}_{\text{spatial}}\) represents the feature map after passing through the local-spatial attention submodule. \[\text{F}_{\text{spatial}}=\sigma\left(\text{Conv}(\text{BN}(\text{ReLU}( \text{Conv}(\text{F}_{\text{channel}}))))\right)\odot\text{F}_{\text{channel}} \tag{2}\]  
Overall, the workflow of the entire module is as follows: the input feature map first passes through the channel attention submodule. After undergoing dimension permutation and MLP processing, the channel attention map is generated using a Sigmoid activation function and then multiplied element-wise with the input feature map to obtain the enhanced feature map. Next, the feature map enters the spatial attention submodule, where convolution operations and a Sigmoid activation function generate the spatial attention map. Finally, the spatial attention map is multiplied element-wise with the channel-enhanced feature map, resulting in the final feature map enhanced by both channel and spatial attention.