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

Ziyi Wang, Feng Gao, Junyu Dong, Qian Du

TL;DR

GLAFormer is a new Transformer architecture designed to detect changes in hyperspectral images by simultaneously capturing broad environmental context and fine-grained local details. By introducing a dual-branch attention module and a noise-suppressing gating network, it achieves state-of-the-art accuracy across major remote sensing benchmarks.

What Problem Does This Paper Address?

Hyperspectral Image (HSI) change detection is the "spot the difference" game of satellite imagery, used for everything from disaster assessment to urban planning. While Transformers have recently overtaken traditional methods due to their ability to model long-range dependencies, they suffer from two major flaws in this context:

  1. "Global Blindness" to Local Details: Standard Transformers prioritize global relationships, often smoothing over the high-frequency, local-level patterns (like small buildings or specific crop changes) that are vital for accurate HSI analysis.
  2. Noise Sensitivity: The standard Feed-Forward Networks (FFN) used in Transformers are often too simple to handle the complex, noisy spectral signals inherent in multi-temporal satellite data.

The authors aim to bridge this gap by creating a model that treats global and local information as distinct "frequencies" that need to be processed differently.

Methods

The authors introduce the GLAFormer, which features two primary innovations:

  • Global and Local Attention Module (GLAM): Instead of a one-size-fits-all attention mechanism, GLAM splits the attention heads.
  • The Global Branch uses average pooling to downsample feature maps, capturing "low-frequency" environmental context.
  • The Local Branch uses non-overlapping window-based attention to focus on "high-frequency" spatial details.
  • These two perspectives are then fused via concatenation to create a comprehensive spatial-spectral representation.
  • Cross-Gated Feed-Forward Network (CGFN): Replacing the standard FFN, the CGFN uses parallel paths with multi-scale depth-wise convolutions (3x3 and 5x5). It employs a gating mechanism—essentially a mathematical filter—that amplifies important features while suppressing noise interference.

The overall architecture follows a Siamese-like structure: two identical GLAFormer encoders process images from Time 1 and Time 2, their features are fused, and a final classification head produces the change map.

Datasets

The model was evaluated on three widely recognized HSI datasets, all captured by the Hyperion sensor on the EO-1 satellite:

  • River Dataset: Imagery of a river in Jiangsu Province, China.
  • Farmland Dataset: Agricultural land in Yancheng City, China.
  • Hermiston Dataset: Irrigated farmland in Hermiston, Oregon, USA, known for its complex, irregular change patterns.

The researchers used a very small training set—only 3% of samples—to test the model's efficiency and robustness.

Key Insights and Ideas

  • Frequency Decomposition: The most elegant idea here is treating "global vs. local" as a signal processing problem. By viewing global context as low-frequency and local details as high-frequency, the authors justify why a single attention mechanism is insufficient.
  • Gating as a Denoising Tool: In remote sensing, atmospheric interference and sensor noise are constant battles. The CGFN’s use of element-wise multiplication in its gating mechanism acts as a learned "mask" that helps the model ignore irrelevant spectral noise.
  • Efficiency through Splitting: By splitting heads between global and local tasks rather than doubling the layers, the model maintains a manageable parameter count while increasing its representational power.

Key Results

GLAFormer consistently outperformed six other state-of-the-art methods (including CDFormer and GTMSiam) across all metrics:

  • Accuracy: It achieved an Overall Accuracy (OA) of 97.81% (River), 98.95% (Farmland), and 97.23% (Hermiston).
  • Kappa Coefficient: This metric, which accounts for random chance in classification, saw an average improvement of 2.77% over the previous best-performing model.
  • Qualitative Edge: Visual results show that GLAFormer produces much cleaner change maps with fewer "salt-and-pepper" noise artifacts and sharper boundaries around changed areas, particularly in the complex Hermiston dataset.

Limitations and Future Work

While the paper demonstrates significant progress, a few areas remain for exploration:

  • Fixed Window Sizes: The local attention uses a fixed 3x3 window. Future iterations might benefit from adaptive window sizes that can change based on the scale of the objects being monitored.
  • Computational Complexity: Although the authors mention channel splitting helps with throughput, Transformers are inherently more resource-intensive than simple CNNs. Further optimization for real-time onboard satellite processing would be a logical next step.
  • Generalization: The study focuses on Hyperion sensor data; testing the architecture on data from newer sensors (like PRISMA or EnMAP) would further validate its versatility.

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 feedforward 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 uses global attention on downsampled feature maps to capture low-frequency information, while the local attention component focuses on high-frequency details using nonoverlapping 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 <uri xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">https://github.com/summitgao/GLAFormer</uri>.
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},
}

Loading related content...

Figure