A hyperspectral image anomaly detection method based on deep and shallow multi-scale feature fusion
By using a multi-scale feature fusion method, the problem of detecting small targets and minute anomalies in hyperspectral images is solved, achieving higher detection accuracy and lower false alarm rate.
Patent Information
- Application Number
- CN202410643307.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2044-05-23
AI Technical Summary
Existing hyperspectral image anomaly detection methods are ineffective when dealing with differences in the size, shape, and texture of different targets or anomalies, especially small targets or tiny anomalies. Furthermore, deep learning-based methods struggle to effectively distinguish between anomalies and background during feature reconstruction, resulting in a high false alarm rate.
A method based on deep and shallow multi-scale feature fusion is adopted. Multi-scale features are extracted through central difference convolution and 3D convolution. Feature fusion is performed by combining spatial and channel attention and guided deformable attention modules, and anomaly detection is performed using the RX algorithm.
It improves the accuracy of anomaly detection in hyperspectral images, can better handle anomalies of different scales and shapes, reduces false alarm rates, and enhances the detection capability for small targets.
Smart Images

Figure CN118351108B_ABST
Abstract
Description
Technical Field
[0001] This invention pertains to digital image processing methods, and particularly relates to a hyperspectral image anomaly detection method based on the fusion of shallow and deep multi-scale features. Background Technology
[0002] In hyperspectral images, different land cover materials exhibit different spectral characteristic curves. These curves are composed of reflectance within different wavelength ranges, and their use allows for effective differentiation of different land cover types. Target detection in hyperspectral images can essentially be viewed as a binary classification problem, with two categories: anomalies and background. Solving hyperspectral image detection based on this binary classification approach can be divided into "spectral matching detection," which requires prior information, and "anomaly detection," which does not. The dividing criterion is whether the spectral information of the target pixel is known. In spectral matching detection, the prior spectral information of the target pixel needs to be compared with the pixel spectrum in the hyperspectral image to effectively differentiate between different pixel types. However, due to limitations in spectral information databases, obtaining prior information is often difficult, significantly restricting the development of supervised target detection. Unsupervised anomaly detection is widely used in real-world land cover scenarios and is currently a research hotspot in remote sensing image processing. The concept of anomalies is distinguished from the background in hyperspectral images; they are often characterized by low probability of occurrence and small proportion. Therefore, anomalies are usually rare in hyperspectral images, accounting for only a small portion of the entire image. These anomalous pixels differ significantly from most pixels in the image in their spectral feature curves. The specific manifestations of anomalies in target detection are diverse; they can be forest fire ignition points, pest-infested areas in farmland requiring protection, and so on, making their applications very broad.
[0003] Existing anomaly detection methods for hyperspectral images mainly fall into the following categories: statistical anomaly detection methods and deep learning-based anomaly detection methods. Statistical anomaly detection methods typically rely on assumptions about data distribution, such as the normal distribution assumption or the Gaussian mixture model assumption. However, these assumptions may not be applicable to all data distributions, leading to false positives or false negatives. Deep learning-based anomaly detection methods are a common unsupervised learning approach that calculates the reconstruction error between the reconstructed background and the input data from an autoencoder. However, this criterion is sometimes unreliable. For example, when anomaly samples and background samples have similar features, the reconstruction error may not be able to effectively distinguish them, resulting in a high false alarm rate. Furthermore, in hyperspectral anomaly detection methods, different targets or anomalies may vary significantly in size, shape, and texture. Detecting small targets or minute anomalies is particularly difficult because they may be obscured by the background at a large scale. Additionally, autoencoders typically use the spectral vector of a single pixel as network input, considering only the spectral differences between pixels, thus ignoring the rich local spatial information of hyperspectral images. Summary of the Invention
[0004] The present invention aims to solve the above-mentioned technical problems existing in the prior art by providing a hyperspectral image anomaly detection method based on the fusion of deep and shallow multi-scale features.
[0005] The technical solution of this invention is: a hyperspectral anomaly detection method based on the fusion of deep and shallow multi-scale features, which is carried out according to the following steps:
[0006] Step 1. The hyperspectral image to be tested, I∈HSI C×H×W Perform central difference convolution operations at three different scales: 3×3, 5×5, and 7×7. After each convolutional layer, add a batch normalization (BN) layer and a sigmoid layer. Finally, output three features: S1, S2, and S3.
[0007] S i =Sigmoid(BN(CDC) α (I))), α∈{3×3, 5×5, 7×7}, i=1,2,3 (1)
[0008] Where C, H, and W represent the number of long and wide bands in the hyperspectral image, respectively, CDC α (·) represents the central difference convolution at three different scales, S i The output features represent the central difference convolutional features at different scales;
[0009] Step 2. For feature S i Performing a 3D convolution operation yields the feature weights U1, U2, and U3:
[0010]
[0011] Wherein, Conv3D represents three-dimensional convolution. These are trainable parameters;
[0012] Step 3. Assign feature weights U j respectively with S i Multiply to calculate weighted features P1, P2, and P3:
[0013]
[0014] Step 4. Using the feature fusion module of spatial and channel attention, the weighted features P2 and P3 are shallowly fused according to formula (4) to obtain feature T:
[0015]
[0016] Where, T∈R C×H×W These are the features output after shallow fusion. PC(P2+P3) are the attention weights generated by the spatial and channel attention modules, with values ranging from 0 to 1.
[0017] Step 5. Deeply fuse features T and P1 using formula (5) through the feature fusion module guided by deformable attention to obtain feature map F;
[0018]
[0019] Here, Concat is the concatenation operation between two features. Calculated using formula (6):
[0020]
[0021] The Softmax(·) function converts the calculated score into attention weights. The relative position bias table is constructed in the Swing Transformer. Q is the query label obtained by linearly transforming P1, as shown in formula (7):
[0022] Q = P1W Q (7)
[0023] The values of K and V are calculated according to formula (8):
[0024]
[0025] The W Q W K and W V There are three trainable parameter matrices. It is obtained by performing bilinear interpolation on the input feature T according to formula (9):
[0026]
[0027] Where φ(·) is the bilinear interpolation function, R+ΔR is the deformation point, and R is the reference point, which is the result of interpolating the input feature map T∈HSI. C×H×W The feature at each location is generated by applying a linear transformation, and ΔR is the offset obtained by inputting Q into the offset network, calculated according to formula (10):
[0028] ΔR=θ offest (Q) (10)
[0029] Where, θ offest (·) represents the offset network;
[0030] Step 6. Process the feature map F using the RX algorithm to obtain the anomaly detection results;
[0031] The RX algorithm is expressed as in formula (11):
[0032]
[0033] Where D(x) is the Mahalanobis distance between the spectrum of the pixel to be measured and the mean vector of the background window. When D(x) is greater than or equal to the decision threshold δ, it is judged as abnormal, i.e., C1. When D(x) is less than the decision threshold δ, it is judged as normal, i.e., C0. x represents the spectrum of a pixel in the feature map F, δ is the decision threshold, and μ represents the average value of the observed background. The calculation formula is shown in (12). -1 Let represent the inverse matrix of the sample covariance matrix of the image to be tested, and the calculation formula is shown in (13);
[0034]
[0035]
[0036] N represents the total number of pixels, T represents the transpose of the matrix, and x τ Let represent the spectral vector of the τth pixel.
[0037] This invention addresses the challenges in deep learning-based hyperspectral anomaly detection, where different targets or anomalies may vary in size, shape, and texture, and small targets or minute anomalies may be obscured by the background at larger scales. It provides a hyperspectral image anomaly detection method based on multi-scale feature fusion, extracting features at different scales, calculating weights to evaluate the importance of each feature, and performing feature weighting to strengthen the constraint or focus on useful features. Utilizing the proposed attention-based multi-scale feature fusion method, deep and shallow gradient fusion is performed on features at three different scales respectively, resulting in more comprehensive and richer image information, thus improving the accuracy of hyperspectral image anomaly detection. Attached Figure Description
[0038] Figure 1 These are sample images and ground condition maps used in embodiments of the present invention.
[0039] Figure 2 This is a comparison chart of the detection results of the present invention and other methods. Detailed Implementation
[0040] The present invention provides a hyperspectral anomaly detection method based on the fusion of deep and shallow multi-scale features, which is carried out according to the following steps:
[0041] Step 1. Take Figure 1 The hyperspectral images I∈HSI shown are: (a) Airport-1; (b) Pavia Center; (c) Airport-3; (d) Texas Coast. C×H×W Three different scale central difference convolution operations (3×3, 5×5, and 7×7) are performed to extract high, medium, and low-level spatial features to improve model performance and training speed. Batch normalization (BN) and sigmoid layers are added after each convolutional layer, finally outputting three features: S1, S2, and S3.
[0042] S i =Sigmoid(BN(CDC) α (I))), α∈{3×3, 5×5, 7×7}, i=1,2,3 (1)
[0043] Where C, H, and W represent the number of long and wide bands in the hyperspectral image, respectively, CDC α (·) represents the central difference convolution at three different scales, S i The output features represent the central difference convolutional features at different scales;
[0044] Step 2. For feature S i Performing a 3D convolution operation yields the feature weights U1, U2, and U3:
[0045]
[0046] Conv3D is a three-dimensional convolution that performs convolution operations in the width, height, and depth dimensions to extract and analyze image features. These are trainable parameters;
[0047] Step 3. Assign feature weights U j respectively with S i Multiply to calculate weighted features P1, P2, and P3:
[0048]
[0049] Step 4. Using the feature fusion module of spatial and channel attention, the weighted features P2 and P3 are shallowly fused according to formula (4) to obtain feature T:
[0050]
[0051] Where, T∈R C×H×W The features output after shallow fusion are summed point by point on features P2 and P3 as the initial input for attention, which is input to the spatial attention module and the channel attention module. PC(P2+P3) is the attention weight generated by the spatial and channel attention modules, with a value between 0 and 1. PC(P2+P3) is multiplied by feature P2, and 1-PC(P2+P3) is multiplied by feature P3. The purpose is to enable feature P2 and feature P3 to be well weighted and averaged.
[0052] Step 5. Deeply fuse features T and P1 using formula (5) through the feature fusion module that guides deformable attention to obtain feature map F;
[0053]
[0054] Here, Concat is the concatenation operation between two features. Calculated using formula (6):
[0055]
[0056] The Softmax(·) function converts the calculated score into attention weights, ensuring that the sum of all weights is 1; E represents the relative position offset, used to determine the offset of the actual sampling position, which is predicted from the input feature map by deformable convolution through network learning. The relative position bias table is constructed in the Swing Transformer. Q is the query label obtained by linearly transforming P1, as shown in formula (7):
[0057] Q = P1W Q (7)
[0058] The values of K and V are calculated according to formula (8):
[0059]
[0060] In the Transformer model, W Q W K and W V It is a key component used to compute self-attention mechanisms, specifically, W Q W K and W V There are three trainable parameter matrices, and the input matrix is... Multiplying each of these three matrices generates matrices Q, K, and V. This process is equivalent to performing a linear transformation on the input. It is obtained by performing bilinear interpolation on the input feature T according to formula (9):
[0061]
[0062] Where φ(·) is the bilinear interpolation function, R+ΔR is the deformation point, and R is the reference point, which is the result of interpolating the input feature map T∈HSI. C×H×W The features at each location are generated by applying a linear transformation. In this embodiment of the invention, the size of the reference point is C×H×2, and the coordinate range of the reference point is {(0,0),...,(H,W)}. The above coordinate range is then normalized to obtain [-1,1]. Then (-1,-1) is the upper left corner, (1,1) is the lower right corner, and ΔR is the offset obtained by inputting Q into the offset network, calculated according to formula (10):
[0063] ΔR=θ offest (Q) (10)
[0064] Where, θ offest (·) represents the offset network;
[0065] Step 6. Process the feature map F using the RX algorithm to obtain the anomaly detection results;
[0066] The RX algorithm is expressed as in formula (11):
[0067]
[0068] Where D(x) is the Mahalanobis distance between the spectrum of the pixel to be measured and the mean vector of the background window. When D(x) is greater than or equal to the decision threshold δ, it is judged as abnormal, i.e., C1. When D(x) is less than the decision threshold δ, it is judged as normal, i.e., C0. x represents the spectrum of a pixel in the feature map F, δ is the decision threshold, and μ represents the average value of the observed background. The calculation formula is shown in (12).-1 Let represent the inverse matrix of the sample covariance matrix of the image to be tested, and the calculation formula is shown in (13);
[0069]
[0070]
[0071] N represents the total number of pixels, T represents the transpose of the matrix, and x τ Let represent the spectral vector of the τth pixel.
[0072] Comparison of the embodiments of the present invention with other methods Figure 1 (ad) detection results are compared, for example Figure 2 As shown, Figure 2 (a) RX; (b) GAED; (c) RCRD; (d) RGAE; (e) FEBPAD; (f) AHMID; (g) Embodiments of the present invention.
[0073] from Figure 2 It can be seen that although the RX and FEBPAD algorithms have good background suppression effects, they cannot separate anomalies from the background in most cases; the RCRD and RGAE algorithms can detect anomalous targets, but the background is relatively clear, and the background suppression effect is not ideal; although the detection results of the GAED and AHMID algorithms are similar to those of this invention, they suffer from the problem of unclear anomalies in the third dataset. From a qualitative analysis perspective, this invention has achieved good detection results on all datasets.
Claims
1. A hyperspectral anomaly detection method based on the fusion of shallow and deep multi-scale features, characterized in that... Follow these steps: Step 1. The hyperspectral image to be tested, I∈HSI C×H×W Perform central difference convolution operations at three different scales: 3×3, 5×5, and 7×7. After each convolutional layer, add a batch normalization (BN) layer and a sigmoid layer. Finally, output three features: S1, S2, and S3. S i =Sigmoid(BN(CDC α (I))),α∈{3×3,5×5,7×7},i=1,2,3 (1) Where C, H, and W represent the number of long and wide bands in the hyperspectral image, respectively, CDC α (·) represents the central difference convolution at three different scales, S i The output features represent the central difference convolutional features at different scales; Step 2. For feature S i Performing a 3D convolution operation yields the feature weights U1, U2, and U3: Wherein, Conv3D represents three-dimensional convolution. These are trainable parameters; Step 3. Assign feature weights U j respectively with S i Multiply to calculate weighted features P1, P2, and P3: Step 4. Using the feature fusion module of spatial and channel attention, the weighted features P2 and P3 are shallowly fused according to formula (4) to obtain feature T: Where, T∈R C×H×W These are the features output after shallow fusion. PC(P2+P3) are the attention weights generated by the spatial and channel attention modules, with values ranging from 0 to 1. Step 5. Deeply fuse features T and P1 using formula (5) through the feature fusion module guided by deformable attention to obtain feature map F; Here, Concat is the concatenation operation between two features. Calculated using formula (6): The Softmax(·) function converts the calculated score into attention weights. The relative position offset table is constructed in SwinTransformer. Q is the query label obtained by linearly transforming P1, as shown in formula (7): Q=P1W Q (7) The values of K and V are calculated according to formula (8): The W Q W K and W V There are three trainable parameter matrices. It is obtained by performing bilinear interpolation on the input feature T according to formula (9): Where φ(·) is the bilinear interpolation function, R+ΔR is the deformation point, and R is the reference point, which is the result of interpolating the input feature map T∈HSI. C ×H×W The feature at each location is generated by applying a linear transformation, and ΔR is the offset obtained by inputting Q into the offset network, calculated according to formula (10): ΔR=θ offest (Q) (10) Where, θ offest (·) represents the offset network; Step 6. Process the feature map F using the RX algorithm to obtain the anomaly detection results; The RX algorithm is expressed as in formula (11): Where D(x) is the Mahalanobis distance between the spectrum of the pixel to be measured and the mean vector of the background window. When D(x) is greater than or equal to the decision threshold δ, it is judged as abnormal, i.e., C1. When D(x) is less than the decision threshold δ, it is judged as normal, i.e., C0. x represents the spectrum of a pixel in the feature map F, δ is the decision threshold, and μ represents the average value of the observed background. The calculation formula is shown in (12). -1 Let represent the inverse matrix of the sample covariance matrix of the image to be tested, and the calculation formula is shown in (13); N represents the total number of pixels, T represents the transpose of the matrix, and x τ Let represent the spectral vector of the τth pixel.
