J. Eur. Opt. Society-Rapid Publ. 2025, 21, 43 Ó The Author( s), published by EDP Sciences, 2025 https:// doi. org / 10.1051 / jeos / 2025038 Available online at: https:// jeos. edpsciences. org
Journal of the European Optical Society-Rapid Publications
RESEARCH ARTICLE
Dual-window transformer framework with pyramid structure and constrained self-attention for hyperspectral anomaly detection
Lei Deng, Bing Zhou, Yudan Chen, and Zhaorui Li * Shijiazhuang Campus, Army Engineering University of PLA, Shijiazhuang, Hebei 050000, PR China
Received 15 July 2025 / Accepted 3 September 2025
Abstract. Hyperspectral anomaly detection( HAD) is widely used in various fields including military, agriculture, mining, and food safety inspection. However, the absence of prior information on targets poses significant challenges to feature extraction and anomaly identification. To address this issue, this paper proposes a novel dual-window transformer framework integrated with a pyramid structure and constrained self-attention mechanism, which effectively leverages both local and global spectral information for anomaly detection. The dual-window transformer is designed to extract deep spectral features by capturing discriminative patterns between central pixels and their surrounding background. Simultaneously, the constrained self-attention module incorporates global contextual information into the feature representation. Furthermore, a stepwise downsampling pyramid architecture is introduced to reduce the sensitivity of the model to dual-window size selection while facilitating the propagation of global information from higher to lower layers. Extensive hyperparameter analysis and comparative experiments demonstrate the robustness and superiority of the proposed framework. The source code is publicly available at: https:// github. com / aosilu / DWT-P-CSA-HAD.
Keywords: Anomaly detection, Transformer, Pyramid structure, Hyperspectral image.
1 Introduction
Hyperspectral imagery constitutes three-dimensional data characterized by high spectral resolution and rich spectral information, facilitating precise pixel-level classification. Within such imagery, anomalous targets typically occupy a minimal number of pixels and exhibit spectra markedly distinct from their surrounding background [ 1 – 5 ]. Hyperspectral anomaly detection( HAD) identifies anomalous pixels without prior knowledge of target or background spectral signatures [ 6 – 8 ].
The research on hyperspectral anomaly detection can be divided into traditional and deep learning methods. The Reed-Xiaoli( RX) algorithm [ 9 ] is a classic statistical approach among traditional methods; it calculates the anomaly level of pixels by assuming that the background follows a multivariate normal distribution. The local variant of the RX algorithm [ 10 ] uses a dual-window to select the background instead of using the entire image, calculating the local anomaly level for each pixel. A weighted method is also used in the RX algorithm [ 11 ], which assigns low weights to abnormal samples and can better estimate the background distribution. The two-step generalized likelihood ratio test( 2S-GLRT) [ 12 ] utilizes design criteria
* Corresponding author: lizhaorui772025 @ 163. com based on the generalized likelihood ratio test and its twostep modification to reduce computational complexity while improving detector performance. The development of compressive sensing theory has led to the use of reconstructionbased methods in HAD. The sparse representation( SR) model [ 13 ] reconstructs all pixels using an overcomplete dictionary, while the residuals represent the degree of pixel anomalies. Collaborative representation( CR) [ 14 ] is one of the commonly used reconstruction methods, which allows all atoms in the dictionary to participate in linear representation and is a pixel-by-pixel detection method. Low-rank representation( LRR) [ 15 ] divides data into sparse backgrounds and anomalies, focusing on describing the global structure of hyperspectral images. The attribute and edge-preserving filtering-based anomaly detection( AED) method [ 16 ] utilizes morphological filtering and support vector machines to achieve anomaly detection, integrating spatial and spectral information. With the deepening of research, deep learning-based HAD technology is gradually receiving attention, and its detection framework is divided into supervised and unsupervised approaches. Li et al. [ 17 ] proposed a supervised anomaly detection framework based on transferred deep CNN, which trains using differential pixel pairs formed by different categories of ground objects in reference images, with the difference between the central pixel and surrounding pixels as the anomaly level of the
This is an Open Access article distributed under the terms of the Creative Commons Attribution License( https:// creativecommons. org / licenses / by / 4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.