Global and Local Attention-Based Transformer for Hyperspectral Image Change Detection

Ziyi Wang, Feng Gao, Junyu Dong, Qian Du

Abstract

Recently Transformer-based hyperspectral image (HSI) change detection methods have shown remarkable performance. Nevertheless, existing attention mechanisms in Transformers have limitations in local feature representation. To address this issue, we propose Global and Local Attention-based Transformer (GLAFormer), which incorporates a global and local attention module (GLAM) to combine high-frequency and low-frequency signals. Furthermore, we introduce a cross-gating mechanism, called cross-gated feed-forward network (CGFN), to emphasize salient features and suppress noise interference. Specifically, the GLAM splits attention heads into global and local attention components to capture comprehensive spatial-spectral features. The global attention component employs global attention on downsampled feature maps to capture low-frequency information, while the local attention component focuses on high-frequency details using non-overlapping window-based local attention. The CGFN enhances the feature representation via convolutions and cross-gating mechanism in parallel paths. The proposed GLAFormer is evaluated on three HSI datasets. The results demonstrate its superiority over state-of-the-art HSI change detection methods. The source code of GLAFormer is available at https://github.com/summitgao/GLAFormer.

Introduction

Hyperspectral Image (HSI) change detection is a critical task in remote sensing, used for applications ranging from disaster assessment to urban planning. While Transformers have recently surpassed traditional methods due to their ability to model long-range dependencies, they face two significant challenges in this domain. First, standard Transformers often exhibit "global blindness," where they prioritize global relationships at the expense of high-frequency, local-level patterns essential for accurate HSI analysis. Second, the standard Feed-Forward Networks (FFN) in Transformers are frequently sensitive to the complex, noisy spectral signals inherent in multi-temporal satellite data.

To address these limitations, we propose GLAFormer, a novel architecture that treats global and local information as distinct frequencies. By integrating a dual-branch attention module and a noise-suppressing gating network, GLAFormer achieves state-of-the-art accuracy across major remote sensing benchmarks.

Methodology

The GLAFormer architecture follows a Siamese-like structure where two identical encoders process images from different time points ($T_1$ and $T_2$). The core of the encoder consists of two primary innovations: the Global and Local Attention Module (GLAM) and the Cross-Gated Feed-Forward Network (CGFN).

Overall architecture of the proposed GLAFormer model, showing the dual-branch encoder and feature fusion process.

Global and Local Attention Module (GLAM)

GLAM decomposes spatial-spectral features into low-frequency and high-frequency components by splitting attention heads. The Global Branch utilizes average pooling to downsample feature maps, capturing broad environmental context. Conversely, the Local Branch employs non-overlapping window-based attention to focus on fine-grained spatial details. These perspectives are concatenated to form a comprehensive representation.

Cross-Gated Feed-Forward Network (CGFN)

The CGFN replaces the standard FFN with parallel paths featuring multi-scale depth-wise convolutions (3x3 and 5x5). It introduces a cross-gating mechanism that acts as a learned filter, amplifying salient features while suppressing noise interference—a common issue in remote sensing due to atmospheric and sensor variations.

Experimental Setup

The model was evaluated on three HSI datasets captured by the Hyperion sensor: River, Farmland, and Hermiston. To test robustness and efficiency, the training set was limited to only 3% of the total samples, challenging the model's ability to generalize from sparse data.

Results and Discussion

GLAFormer consistently outperformed state-of-the-art methods, including CDFormer and GTMSiam. Quantitatively, it achieved an Overall Accuracy (OA) of 97.81% on the River dataset, 98.95% on the Farmland dataset, and 97.23% on the Hermiston dataset. The Kappa Coefficient showed an average improvement of 2.77% over the previous best-performing models.

Visual comparison of change detection results on the River dataset. GLAFormer (h) produces cleaner maps with fewer noise artifacts compared to other methods (a-g).

Qualitatively, GLAFormer produces significantly cleaner change maps. As shown in the visual comparisons, the model effectively reduces "salt-and-pepper" noise and maintains sharper boundaries around changed areas, particularly in complex scenes. This success is attributed to the frequency decomposition in GLAM and the denoising capability of the CGFN gating mechanism.

Conclusion

GLAFormer demonstrates that simultaneously capturing global context and local details is vital for HSI change detection. While the current model uses fixed window sizes for local attention, future work could explore adaptive windowing to better handle multi-scale objects. Additionally, optimizing the architecture for real-time onboard satellite processing and testing on newer sensors like PRISMA or EnMAP are promising directions for further validation.

Summary updated

Abstract

Recently Transformer-based hyperspectral image (HSI) change detection methods have shown remarkable performance. Nevertheless, existing attention mechanisms in Transformers have limitations in local feature representation. To address this issue, we propose Global and Local Attention-based Transformer (GLAFormer), which incorporates a global and local attention module (GLAM) to combine high-frequency and low-frequency signals. Furthermore, we introduce a cross-gating mechanism, called cross-gated feed-forward network (CGFN), to emphasize salient features and suppress noise interference. Specifically, the GLAM splits attention heads into global and local attention components to capture comprehensive spatial-spectral features. The global attention component employs global attention on downsampled feature maps to capture low-frequency information, while the local attention component focuses on high-frequency details using non-overlapping window-based local attention. The CGFN enhances the feature representation via convolutions and cross-gating mechanism in parallel paths. The proposed GLAFormer is evaluated on three HSI datasets. The results demonstrate its superiority over state-of-the-art HSI change detection methods. The source code of GLAFormer is available at \url{https://github.com/summitgao/GLAFormer}.
BibTeX
@article{wang2025global,
  author = {Ziyi Wang and Feng Gao and Junyu Dong and Qian Du},
  title = {{Global and Local Attention-Based Transformer for Hyperspectral Image Change Detection}},
  journal = {IEEE Geosci. Remote. Sens. Lett.},
  year = {2025},
  doi = {10.1109/lgrs.2024.3505294},
}
Figure