# Multi-Scale Twin Networks for Coastal Zone Change Detection in Remote Sensing Imagery
## 3 Principles and Methods
### Contextual Information Integration
#### 3.2.2 Spatio-Temporal Difference Attention Module  
In change detection tasks, many methods are available for processing the dual-branch feature maps of Siamese networks, including direct subtraction, summation, splicing, and enhancement mechanisms. However, each method has its inherent limitations. The subtraction-based method typically generates a difference map by computing the pixel-wise difference between two temporal images. This approach is simple and intuitive but tends to introduce significant noise under varying lighting conditions, observation angles, and noise disturbances, resulting in error accumulation. The splicing-based method retains the complete information of each temporal phase by concatenating the dual-temporal images along the channel dimension. While this approach preserves more feature information, its main limitation is that it does not provide an explicit representation of change features, and the model must learn to autonomously extract change-related information from the spliced features, making the model's training highly dependent on the quality and size of the labeled dataset. Therefore, the spatio-temporal difference attention module adopts a two-branch structure consisting of a subtraction branch and a concatenation branch, as shown in Figure 5, aiming to learn both global change-related information at the target level and fine-grained local contexts between the two temporal-phase feature maps. The subtraction branch computes the absolute difference between the dual-branch feature maps at the same scale, which is then fed into the subsequent coordinate attention module (CAM) to capture the spatio-temporal differences between the dual-temporal feature maps. Since the input dual-temporal images are not ordered temporally, using the absolute difference eliminates the effect of change direction, improves detection symmetry and robustness, reduces interference from negative noise, and unifies the scale of the change features, thereby improving the accuracy and stability of the change detection task. The connection branch concatenates the dual-branch feature maps at the same scale along the channel dimension and then passes through two convolutional layers to extract local context information, thereby supplementing the features and reducing noise interference. The entire process of the SDAM is represented by the following formula:  
\[F_{D}=\left|F_{1}^{i(2)}-F_{2}^{i(2)}\right| \tag{6}\]  
\[F^{\prime\prime}=\text{CA}(F_{D}) \tag{7}\]  
\[F_{C}=\odot_{1}\left(\odot_{3}\left(F_{1}^{i(2)}\odot F_{2}^{i(2)}\right)\right) \tag{8}\]  
\[F_{S}=F_{C}\oplus F^{\prime\prime} \tag{9}\]  
where \(\left|\cdot\right|\) represents the absolute value, CA denotes the coordinate attention module, and \(\odot_{1}\) and \(\odot_{3}\) are the convolution operations of \(1\times 1\) and \(3\times 3\), respectively, followed by batch normalization and ReLU activation. At present, global pooling and convolution operations are widely used in attention mechanisms in both domestic and international change detection research. However, pooling operations compress the feature map into one dimension, leading to a loss of positional details, while convolution operations have a limited receptive field, which  
Figure 5: Illustration of our spatio-temporal difference attention module (SDAM). hinders the extraction of long-range dependencies. Therefore, in the subtraction branch, we used the coordinate attention module to extract both global and local features. In the coordinate attention module, two average pooling operations with different spatial ranges are applied to encode each channel horizontally and vertically, respectively. The outputs of the pooling layers are concatenated and passed through a \(1\times 1\) convolution operation. The resulting tensor is then split into two independent tensors, generating attention vectors with the same number of channels for the horizontal and vertical coordinates of input X.