Hyperspectral anomaly target detection method based on asymmetric autoencoder
By using a residual self-attention module based on an asymmetric autoencoder and a low-rank loss function optimization model, the problem of distinguishing between background and anomaly in hyperspectral anomaly detection is solved, and higher detection accuracy is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-16
- Publication Date
- 2026-03-17
AI Technical Summary
Existing autoencoders have difficulty effectively distinguishing between background and anomalies in hyperspectral anomaly detection, resulting in low detection rates.
We employ an asymmetric autoencoder-based approach, combining a residual self-attention module and a low-rank loss function. By optimizing the model through reconstruction loss and low-rank loss, we enhance the difference between background and anomalies.
It improves the detection rate of hyperspectral anomalies, increases the difference between background and anomalies, and improves the accuracy of detection.
Smart Images

Figure CN115719449B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a remote sensing image processing technique, and more particularly to a method for detecting hyperspectral anomalies based on an asymmetric autoencoder. Background Technology
[0002] Hyperspectral images are a type of three-dimensional cubic data. Two dimensions represent spatial location; the other dimension represents the reflectance of ground objects in different bands. Compared to multispectral images, hyperspectral images have hundreds of continuous spectral bands, providing rich spectral information. Based on variations in spectral features, hyperspectral images can more reliably identify ground objects. Therefore, hyperspectral images are suitable for a variety of remote sensing image processing applications, such as spectral unmixing, classification, change detection, and target detection.
[0003] The purpose of target detection is to distinguish target pixels from background pixels based on spectral features. Target pixels have two characteristics: first, they exhibit significant spectral differences compared to surrounding background pixels; second, they are small in size and have a low probability of occurrence. Based on the prior spectral information regarding the presence of target pixels, target detection can be divided into target matching and anomaly detection. Since it does not require prior spectral information about anomalous target pixels, anomaly detection is more practical in applications. Therefore, hyperspectral anomaly detection is widely used in environmental monitoring, search and rescue, and military reconnaissance.
[0004] Meanwhile, in recent years, with the rapid development of deep learning theory, research on deep learning-based hyperspectral anomaly detection methods has received widespread attention. Most deep learning-based hyperspectral anomaly detection methods use autoencoders as the backbone of their models (an autoencoder is an unsupervised neural network model consisting of an encoder and a decoder. The encoder maps the input data to a lower-dimensional space and generates hidden layer codes containing important features. The decoder uses the hidden layer codes to output reconstructed data. Autoencoders can learn the features of most samples). The principle is that in an image scene, background samples are the majority, and they can be reconstructed relatively well, while anomalies cannot. Therefore, reconstruction errors (e.g., spectral angular distance, Euclidean distance, etc.) can be used as a detection method to determine whether a larger reconstruction error indicates an anomaly. However, autoencoders have strong nonlinear fitting capabilities. In practical applications, anomalies can also be reconstructed very well, making it impossible to separate anomalies from the background.
[0005] Against this background, the present invention proposes a hyperspectral anomaly target detection method based on an asymmetric autoencoder. Summary of the Invention
[0006] The purpose of this invention is to provide a hyperspectral anomaly target detection method based on an asymmetric autoencoder, which, compared with existing technologies, can better increase the difference between background and anomaly and improve the detection rate.
[0007] To achieve the above objectives, this invention provides a hyperspectral anomaly target detection method based on an asymmetric autoencoder, comprising the following steps:
[0008] S1. Convert the acquired 3-D hyperspectral image into a 2-D matrix, with each pixel serving as a training sample, to obtain the global training sample;
[0009] S2. Shuffle the order of the global training samples obtained in step S1 and set the batch size for the training phase.
[0010] S3. Input the training samples of each batch obtained in step S2 into the asymmetric autoencoder based on the residual self-attention module mechanism, and output the corresponding reconstructed pixels and hidden layer codes.
[0011] S4. Calculate the Smooth-l1 loss of the reconstructed pixel and the input pixel obtained in step S3, and use it as the reconstruction loss; at the same time, calculate the logarithm of the kernel norm of the hidden layer coding obtained in step S3, and use it as the low-rank loss.
[0012] S5. The two loss values calculated in step S4 are weighted and summed to form the total loss function of the model. The model is then optimized using backpropagation.
[0013] S6. Input the 2-D hyperspectral image in its original order into the model trained in step S5, output the reconstructed image, calculate the Euclidean distance between the original 2-D image and the reconstructed image as the anomaly score of the pixel, and output the final detection image.
[0014] Preferably, in step S1, the 3-D hyperspectral image Y∈R is set. H×W×D Where H, W, and D represent the image height, width, and number of bands, respectively;
[0015] A 3-D hyperspectral image is unfolded into a 2-D image Y = [y1, y2, ..., y]. i ,...,y l ]∈R D×L Where L represents the total number of pixels in the image, L = H × W.
[0016] Preferably, the batch size in step S2 is set to a power of 2.
[0017] Preferably, the asymmetric autoencoder based on the residual self-attention module mechanism described in step S3 includes an encoder and a decoder;
[0018] The encoding process is as follows:
[0019] Z = encoder(Y) (1)
[0020] The decoding process is as follows:
[0021]
[0022] Here, encoder(·) and decoder(·) represent the encoding and decoding processes, respectively.
[0023] Preferably, the encoder includes a residual self-attention module and a fully connected layer, and the decoder consists of a fully connected layer;
[0024] The residual self-attention module is calculated as follows:
[0025]
[0026] Q, K, and V are obtained through linear transformation, and the calculation formula is as follows:
[0027] Q = W q Y (4)
[0028] K = W k Y (5)
[0029] V = W v Y (6)
[0030] Among them, W q W k and W v It is the weight matrix, softmax is the activation function, and d k Let K be the feature dimension of matrix K;
[0031] The Sigmoid function is used as the activation function in fully connected layers. The Sigmoid function is shown below:
[0032]
[0033] Preferably, the reconstruction loss function in step S4 is:
[0034]
[0035] In the formula, Y and These are the original image and the reconstructed image, respectively.
[0036] Preferably, the low-rank loss function mentioned in step S4 is:
[0037]
[0038]
[0039] In the formula, Z is the hidden layer code, ||Z||* Let represent the nuclear norm of Z, and tr(·) represent the sum of the eigenvalues of matrix Z.
[0040] Preferably, the total loss function mentioned in step S5 is:
[0041]
[0042] In the formula, It is the reconstruction loss function. It is a low-rank loss function, and λ is a trade-off parameter.
[0043] Preferably, λ is set to 2.
[0044] Preferably, the anomaly score for each pixel in step S6 is calculated using the following formula:
[0045]
[0046] In the formula, y i It is the input pixel; It is a reconstructed pixel.
[0047] Therefore, the present invention employs the above-mentioned hyperspectral anomaly target detection method based on asymmetric autoencoders, which, compared with the prior art, can better increase the difference between background and anomalies and improve the detection rate.
[0048] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0049] Figure 1 This is a flowchart of the method of the present invention;
[0050] Figure 2 This is a schematic diagram of the residual self-attention module of the present invention;
[0051] Figure 3 This is a schematic diagram of the asymmetric autoencoder based on residual self-attention mechanism of the present invention.
[0052] Figure 4 Pseudocolor images of hyperspectral images from the San Diego Airport dataset;
[0053] Figure 5 The figure is for reference in the experimental example;
[0054] Figure 6 This is a graph showing the results of processing the San Diego Airport dataset using RX.
[0055] Figure 7 This is a graph showing the results of processing the San Diego Airport dataset using LRX.
[0056] Figure 8This is a diagram showing the results of processing the San Diego Airport dataset using CRD.
[0057] Figure 9 This is a diagram showing the results of processing the San Diego Airport dataset using this embodiment.
[0058] Figure 10 This is a comparison chart of the 2-D ROC curves of the proposed method and three benchmark methods in the experimental example of this invention. Detailed Implementation
[0059] The present invention will be further described below with reference to the accompanying drawings. It should be noted that this embodiment is based on the present technical solution and provides detailed implementation methods and specific operation processes, but the protection scope of the present invention is not limited to this embodiment.
[0060] like Figures 1-3 As shown, the present invention includes the following steps:
[0061] S1. Convert the acquired 3-D hyperspectral image into a 2-D matrix, with each pixel serving as a training sample, to obtain the global training sample;
[0062] Preferably, in step S1, the 3-D hyperspectral image Y∈R is set. H×W×D Where H, W, and D represent the height, width, and number of bands of the image, respectively; a 3-D hyperspectral image is unfolded into a 2-D image Y = [y1, y2, ..., y]. i ,...,y l ]∈R D×L Where L represents the total number of pixels in the image, L = H × W.
[0063] S2. Shuffle the order of the global training samples obtained in step S1 and set the batch size for the training phase.
[0064] Preferably, the batchsize in step S2 is set to a power of 2; in this embodiment, the batchsize is set to 256.
[0065] S3. Input the training samples of each batch obtained in step S2 into the asymmetric autoencoder based on the residual self-attention module mechanism, and output the corresponding reconstructed pixels and hidden layer codes.
[0066] Preferably, the asymmetric autoencoder based on the residual self-attention module mechanism described in step S3 includes an encoder and a decoder;
[0067] In this embodiment, the encoder comprises nine residual self-attention modules and three fully connected layers. The sizes of these three fully connected layers are (D, 1000), (1000, 1000), and (1000, 7), respectively. The encoding process is as follows:
[0068] Z = encoder(Y) (1)
[0069] Unlike the encoder, the decoder consists of only three fully connected layers with dimensions of (7, 1000), (1000, 1000), and (1000, D). The decoding process is as follows:
[0070]
[0071] Here, encoder(·) and decoder(·) represent the encoding and decoding processes, respectively.
[0072] Preferably, the encoder includes a residual self-attention module and a fully connected layer, and the decoder consists of a fully connected layer;
[0073] The residual self-attention module is calculated as follows:
[0074]
[0075] Q, K, and V are obtained through linear transformation, and the calculation formula is as follows:
[0076] Q = W q Y (4)
[0077] K = W k Y (5)
[0078] V = W v Y (6)
[0079] Among them, W q W k and W v It is a weight matrix, with a size of D×D, and softmax is the activation function. k Let K be the feature dimension of matrix K;
[0080] The Sigmoid function is used as the activation function in fully connected layers. The Sigmoid function is shown below:
[0081]
[0082] S4. Calculate the Smooth-l1 loss of the reconstructed pixel and the input pixel obtained in step S3, and use it as the reconstruction loss; at the same time, calculate the logarithm of the kernel norm of the hidden layer coding obtained in step S3, and use it as the low-rank loss.
[0083] Preferably, the reconstruction loss function in step S4 is:
[0084]
[0085] In the formula, Y and These are the original image and the reconstructed image, respectively.
[0086] Preferably, to maintain the low-rank nature of the background portion, this embodiment utilizes a loss function that constrains the low-rank nature of the hidden space. Since the rank of a matrix is non-convex, it is difficult to solve in optimization problems. Generally, its convex approximation kernel norm (the kernel norm is the sum of the singular values of a matrix) is used to solve this problem. In practice, to avoid a large difference in magnitude between the kernel norm and the model's reconstruction loss function, the logarithm of the kernel norm is used as the low-rank loss function. The low-rank loss function mentioned in step S4 is:
[0087]
[0088]
[0089] In the formula, Z is the hidden layer code, ||Z|| * Let represent the nuclear norm of Z, and tr(·) represent the sum of the eigenvalues of matrix Z.
[0090] S5. The two loss values calculated in step S4 are weighted and summed to form the total loss function of the model. The model is then optimized using backpropagation.
[0091] Preferably, the total loss function mentioned in step S5 is:
[0092]
[0093] In the formula, It is the reconstruction loss function. It is a low-rank loss function, and λ is a trade-off parameter.
[0094] Preferably, λ is set to 2.
[0095] S6. Input the 2-D hyperspectral image in its original order into the model trained in step S5, output the reconstructed image, calculate the Euclidean distance between the original 2-D image and the reconstructed image as the anomaly score of the pixel, and output the final detection image.
[0096] Preferably, the anomaly score for each pixel in step S6 is calculated using the following formula:
[0097]
[0098] In the formula, y i It is a pixel; It is a reconstructed pixel.
[0099] To illustrate the effectiveness of this embodiment, the following experimental example is provided:
[0100] First, the hyperspectral dataset used in the experiment was the San Diego Airport data. This dataset was acquired by AirborneVisible / Infrared Imaging Spectrometer at San Diego Airport, California. The image size is 100×100×189 pixels, the spatial resolution is 3.5 meters, and the anomalous targets are three aircraft, with an anomalous proportion of 1.34%.
[0101] Then, using RX (Reed-Xiaoli), LRX (Local RX), and CRD (collaborative representation-based detector) as benchmark methods, a comparison was made with the hyperspectral anomalous target detection method based on asymmetric autoencoders described in this invention. Figures 4-9 As can be seen, the method proposed in this invention can clearly detect the location of the three abnormal aircraft.
[0102] To further quantify the detection accuracy of several anomaly detection methods, the ROC (Receiver Operating Characteristic) curve and AUC (Area Under Curve) value were used as detection metrics. ROC (FPR, TPR) describes the relationship between the false positive rate (FPR) and the true positive rate (TPR) at different thresholds. The closer the curve is to the upper left corner of the coordinate axis, the higher the detection rate.
[0103] It should be noted that, under certain thresholds, the formulas for calculating FPR and TPR are as follows:
[0104]
[0105]
[0106] Where TP (True Positive) and TN (True Negative) represent the number of detected true anomalies and background pixels, respectively; FP (False Positive) and FT (False Negative) represent the number of pixels falsely detected as anomalies and background pixels, respectively. The AUC value is the area under the ROC curve.
[0107] Table 1 compares the AUC values of the proposed method and the three benchmark methods.
[0108] RX LRX CRD Example 0.9403 0.9417 0.9664 0.9938
[0109] Depend on Figure 10 As shown in Table 1, the anomaly detection method proposed in this invention can achieve high detection accuracy, which is improved by 0.0535, 0.0521 and 0.0274 compared with RX, LRX and CRD respectively.
[0110] Therefore, the present invention adopts the above-mentioned hyperspectral anomaly target detection method based on asymmetric autoencoder, which is an end-to-end anomaly detection method. It constructs a new hyperspectral anomaly detection model and proposes a residual attention module. At the same time, it proposes a low-rank loss function for the hidden layer space. This method weakens the model's ability to reconstruct anomalies, increases the separation between background and anomalies, and does not require the construction of potential background training samples.
[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A hyperspectral anomaly detection method based on asymmetric autoencoder, characterized in that: The method comprises the following steps: S1, converting the obtained 3-D hyperspectral image into a 2-D matrix, taking each pixel as a training sample, and obtaining global training samples; S2, shuffling the global training samples obtained in step S1 in sequence, and setting the batch size of the training stage; S3, inputting each batch of training samples obtained in step S2 into an asymmetric autoencoder based on a residual self-attention module mechanism, and outputting corresponding reconstructed pixels and hidden layer encodings; S4, calculating the reconstruction loss of the reconstructed pixel obtained in step S3 and the input pixel Smooth-l 1 the loss of the reconstructed pixel obtained in step S3 and the input pixel as the reconstruction loss, and calculating the logarithm of the nuclear norm of the hidden layer encoding obtained in step S3 as the low-rank loss; S5, weighting and summing the two loss values calculated in step S4 to obtain a total loss function of the model, and optimizing the model by using the back propagation method; S6, inputting the 2-D hyperspectral image without shuffling into the model trained in step S5, outputting a reconstructed image, calculating the Euclidean distance between the original 2-D image and the reconstructed image as the anomaly score of each pixel, and outputting a final detection map; The asymmetric autoencoder based on the residual self-attention module mechanism in step S3 comprises an encoder and a decoder. The encoding process is as follows: (1) The decoding process is as follows: (2) wherein encoder (1000) and decoder (2000) represent the encoding process and the decoding process, respectively. wherein encoder (1000) and decoder (2000) represent the encoding process and the decoding process, respectively. The encoder comprises a residual self-attention module and a fully connected layer, and the decoder comprises a fully connected layer; The residual self-attention module is calculated as follows: (3) Wherein Q, K and V are obtained by linear transformation, and the calculation formula is as follows: (4) (5) (6) wherein, , and are weight matrices, softmax is an activation function, d k is the feature dimension of the matrix K; In the fully connected layer, a Sigmoid function is used as an activation function, and the Sigmoid function is as follows: (7)。 2. The hyperspectral anomaly detection method based on asymmetric autoencoder according to claim 1, characterized in that: Setting 3-D hyperspectral image in step S1 where H, W and D represent the height, width and number of bands of the image, respectively; 3-D hyperspectral image unfolding into 2-D images where L represents the total number of pixels in the image, L = H x W.
3. The hyperspectral anomaly detection method based on asymmetric autoencoder according to claim 2, characterized in that: The batch size in step S2 is set to a power of 2.
4. The hyperspectral anomaly detection method based on asymmetric autoencoder according to claim 3, characterized in that: The reconstruction loss function in step S4 is: (8) wherein and are the original and reconstructed images, respectively.
5. The hyperspectral anomaly detection method based on asymmetric autoencoder according to claim 4, characterized in that: The low-rank loss function in step S4 is: (9) (10) wherein is the hidden layer encoding, denotes the nuclear norm of denotes the sum of the eigenvalues of the matrix Z.
6. The hyperspectral anomaly detection method based on asymmetric autoencoder according to claim 5, characterized in that: The total loss function in step S5 is: (11) wherein is the reconstruction loss function, is the low-rank loss function, is the trade-off parameter.
7. The hyperspectral anomaly detection method based on asymmetric autoencoder according to claim 6, characterized in that: Value is 2.
8. The hyperspectral anomaly detection method based on asymmetric autoencoder according to claim 7, characterized in that: The anomaly score of each pixel in step S6 is calculated by the following formula: (12) wherein is an input pixel; is a reconstructed pixel.