Residual attention mechanism based autoencoder for hyperspectral anomaly detection
Patent Information
- Application Number
- CN202410533887.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2044-04-30
AI Technical Summary
[0006]本发明目的在于针对上述现有技术的不足,提出一种基于残差注意力机制的自编码器高光谱异常检测方法,用于解决现有技术中高光谱异常检测算法提取光谱特征能力有限、异常检测稳定性较差以及检测精度低的问题;首先在卷积自编码模型的基础上对编码器部分引入多层卷积提升模型特征提取能力,通过残差模块来减少网络层间的语义差异,然后利用ECA注意力机制对不同特征赋予不同的权重,从而加强网络模型对重要特征的学习能力,降低无关特征带来的干扰
[0017]第一、由于本发明采用残差注意力机制的多层卷积自编码网络,使得模型的光谱特征提取能力提高,可以更好地重构背景信息,从而有效提升了模型的异常检测能力;
Smart Images

Figure CN118537725B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, and further relates to hyperspectral anomaly target detection, specifically a hyperspectral anomaly detection method based on a residual attention mechanism using an autoencoder, which can be used for anomaly detection in hyperspectral images. Background Technology
[0002] Hyperspectral remote sensing is an important tool for acquiring spectral information of ground objects and has broad application prospects. However, a large number of anomalous targets exist in hyperspectral remote sensing images, such as underground facilities, military installations, and soil environments. These targets often have low spectral reflectance, making them difficult to identify directly by the naked eye or traditional identification methods. Therefore, hyperspectral anomalous target detection has become one of the current research hotspots. In recent years, deep learning has achieved great success in the field of computer vision and has also been successfully applied to hyperspectral anomalous target detection.
[0003] Depending on the processing method, hyperspectral anomaly detection methods can be divided into traditional methods and deep learning methods. For both methods, feature extraction and detection techniques are two fundamental elements. The performance of hyperspectral image detection largely depends on feature extraction. Classic hyperspectral anomaly detection methods include:
[0004] Reed et al. proposed a classic Reed-Xiaoli (RX) anomaly detection algorithm in Chen JY, Reed I SA detection algorithm for optical targets in clutter[J]. IEEE Transactions on Aerospace and Electronic Systems, 1987(1):46-59. This method assumes that the probability density function of the background can be modeled as a multivariate Gaussian distribution, thereby calculating the Mahalanobis distance between the measured pixel and the mean of the background. By comparing the Mahalanobis distance with a preset threshold, the pixel is determined to be either background or anomaly. This RX detection algorithm has high computational efficiency and good background detection performance. Depending on the background description, the RX detection algorithm can be implemented in two different ways. One is Local RX (LRX), which treats the area around the measured pixel as the background and then uses a dual-window method to detect anomalous targets. The other is Global RX (GRX), which treats the entire image scene as the background. Since all pixels of the entire image scene or local region are used to calculate the background statistics, the mean and covariance matrix of the background are easily corrupted by anomalies, which may lead to unstable performance of the RX algorithm.
[0005] The traditional methods described above utilize the statistical features of images to construct linear predictors, thus failing to represent the complex relationships between imaging conditions. Deep learning-based nonlinear predictors offer a solution. Deep learning consists of multiple processing layers, similar to neurons in the human brain, capable of learning multi-level representations of data. Xia et al., in their paper "Learning discriminative reconstructions for unsupervised outlier removal [C]. International Conference on Computer Vision. IEEE, 2015: 1511-1519," first applied Autoencoder (AE) to reconstruct background and detect anomalies. Autoencoders are characterized by a bottleneck design, limiting the dimensionality of information transmitted after the input layer, which helps extract key features and enhances the robustness of the detection algorithm. However, this method has limited ability to extract spectral features, poor stability, and the effect of reconstructing background images is not ideal; it cannot accurately detect some subtly distributed anomalies. Summary of the Invention
[0006] The purpose of this invention is to address the shortcomings of existing technologies by proposing a hyperspectral anomaly detection method based on a residual attention mechanism using an autoencoder. This method solves the problems of limited spectral feature extraction capability, poor anomaly detection stability, and low detection accuracy in existing hyperspectral anomaly detection algorithms. Firstly, multi-layer convolution is introduced into the encoder part of the convolutional autoencoder model to enhance the model's feature extraction capability. A residual module is used to reduce semantic differences between network layers. Then, the ECA attention mechanism is used to assign different weights to different features, thereby strengthening the network model's ability to learn important features and reducing interference from irrelevant features. This invention can effectively improve classification accuracy and increase the consistency of classification results across regions.
[0007] The specific steps of this invention to achieve the above objectives are as follows:
[0008] (1) Input the original hyperspectral image and preprocess it to obtain the denoised hyperspectral image. Then, it is serialized to obtain the spectral sequence; where M and N represent the number of rows and columns of the hyperspectral image, respectively. Let L represent the i-th spectral vector, and L represent the number of spectral channels;
[0009] (2) Based on the real ground cover map, 5-8% of the data in the denoised hyperspectral image are randomly selected as training samples, and the remaining data are used as test samples to form training dataset and test dataset respectively.
[0010] (3) Construct an autoencoder deep convolutional network model containing an encoder and a decoder. The structure is: input layer → encoder → attention mechanism module → decoder → output layer, where the encoder is a multi-layer convolutional structure; the input layer uses the spectral sequence as the original input information, and the output layer is used to output the reconstructed background image.
[0011] (4) Use the training dataset as the input of the model constructed in step (3), use the model to extract the features of each pixel of the training sample, use the result of the forward propagation of the model as the output of the model, solve the error between the output and the original input image and backpropagate the error to achieve parameter optimization and obtain the trained deep convolutional autoencoder network model.
[0012] (5) Input the test dataset into the trained deep convolutional autoencoder network model to obtain the prediction detection results of the test data;
[0013] (6) Anomaly detection is performed on the prediction detection results output by the deep convolutional autoencoder network model by combining the real ground feature map;
[0014] (7) Compare the predicted detection results with the actual ground cover markers and calculate the overall detection accuracy of the hyperspectral image;
[0015] (8) On the hyperspectral image after detection, two different colors are used as base colors to color the abnormal information and background information respectively, and the final detection result image is obtained and output.
[0016] Compared with the prior art, the present invention has the following advantages:
[0017] First, because this invention uses a multi-layer convolutional autoencoder network with residual attention mechanism, the model's spectral feature extraction capability is improved, and background information can be better reconstructed, thereby effectively improving the model's anomaly detection capability.
[0018] Secondly, because this invention combines the difference in spectral angular distance between background information and anomaly information to optimize the model loss function and makes full use of the statistical characteristics of hyperspectral images, it effectively enhances the robustness of the model.
[0019] This invention addresses the limitations of current deep learning autoencoder generative network architectures in extracting spectral features, their poor stability, and unsatisfactory background image reconstruction results. It improves deep learning methods for hyperspectral image applications, effectively achieving anomaly detection in hyperspectral images and providing a technical solution to the accuracy problem of hyperspectral image detection. Simulation results show that the autoencoder hyperspectral anomaly detection method using a residual attention mechanism employed in this invention achieves excellent anomaly detection performance, high accuracy, and significantly improved detection of subtle edge anomalies. Attached Figure Description
[0020] Figure 1 This is a flowchart illustrating the overall implementation of the present invention;
[0021] Figure 2 The image used in the simulation in this embodiment of the invention is a hyperspectral image from Viareggio, Italy.
[0022] Figure 3 This is a schematic diagram of real ground feature markings in a hyperspectral image, as shown in an embodiment of the present invention.
[0023] Figure 4 In this embodiment of the invention, an existing RX anomaly detection method is used to... Figure 3 A diagram illustrating the test results;
[0024] Figure 5 In this embodiment of the invention, a classic autoencoder network anomaly detection method is used to... Figure 3 A diagram illustrating the test results;
[0025] Figure 6 To use the method of the present invention to Figure 3 A diagram illustrating the test results. Detailed Implementation
[0026] The present invention will now be further described with reference to the accompanying drawings.
[0027] Example 1: Refer to Appendix Figure 1 The present invention proposes a method for detecting hyperspectral anomalies based on an autoencoder with a residual attention mechanism, comprising the following steps:
[0028] Step 1. Input the original hyperspectral image and preprocess it to obtain the denoised hyperspectral image. Then, it is serialized to obtain the spectral sequence; where M and N represent the number of rows and columns of the hyperspectral image, respectively. Let represent the i-th spectral vector, and L represent the number of spectral channels. The preprocessing operations used in this embodiment include: firstly, the image to be detected is processed by multilinear regression to remove residual stripe noise, and then the noise variance is normalized by noise whitening to achieve image denoising.
[0029] Step 2. Based on the real ground cover map, randomly select 5-8% of the data from the denoised hyperspectral image as training samples, and use the remaining data as test samples to form the training dataset and the test dataset respectively.
[0030] Step 3. Construct an autoencoder deep convolutional network model containing an encoder and a decoder, with the following structure: input layer → encoder → attention mechanism module → decoder → output layer, wherein the encoder is a multi-layer convolutional structure; the input layer uses the spectral sequence as the original input information, and the output layer is used to output the reconstructed background image;
[0031] The encoder described above contains three identical coding layers, with a residual module inserted between the second and third coding layers. Each coding layer employs multi-layer convolution to acquire data features, and all acquired data features are transmitted to the attention mechanism module. The three identical coding layers have the following structure: first convolutional layer → first normalization layer → second convolutional layer → second normalization layer → third convolutional layer.
[0032] The attention mechanism module described above adopts the ECA attention mechanism. The input is the data features encoded by the encoder, and the output is the latent features selected by the ECA attention mechanism. The module structure is as follows: module input layer → data preprocessing layer → pooling layer → convolutional layer → normalization layer → module output layer.
[0033] The decoder consists of three decoding layers; and the input of the decoder is the latent features selected by the attention mechanism, and the output is the reconstructed image features.
[0034] Step 4. Use the training dataset as input to the model built in Step 3, use the model to extract the features of each pixel of the training samples, use the result of the forward propagation of the model as the output of the model, solve the error between the output and the original input image and backpropagate the error to optimize the parameters and obtain the trained deep convolutional autoencoder network model.
[0035] Step 5. Input the test dataset into the trained deep convolutional autoencoder network model to obtain the prediction and detection results of the test data;
[0036] Step 6. Perform anomaly detection on the predicted detection results output by the deep convolutional autoencoder network model by combining the actual ground feature map. In this embodiment, the Mahalanobis distance between the original input data and the model output result is calculated, and anomalies are detected by the difference value.
[0037] Step 7. Compare the predicted detection results with the actual ground cover markers and calculate the overall detection accuracy of the hyperspectral image, which is the ratio of the number of correctly detected pixels to the total number of test sample pixels.
[0038] Step 8. On the detected hyperspectral image, use two different colors as base colors to color the abnormal information and the background information respectively, and get the final detection result image and output it.
[0039] Example 2: The overall implementation steps of the detection method proposed in this example are the same as in Example 1. Specific parameter settings are given below, and the implementation process of this invention is described in further detail:
[0040] Step A. Perform multilinear regression processing on the image to be detected to remove residual stripe noise, and use noise whitening to normalize the noise variance to obtain a denoised hyperspectral image.
[0041] Step B. Serialize the preprocessed hyperspectral image to obtain i spectral sequences.
[0042] Step C. Use the single-channel spectral sequence in the hyperspectral image as the raw input information.
[0043] Step D. Based on the actual ground cover map, randomly select 6% of the hyperspectral data as training samples and the remaining data as test samples.
[0044] Step E. Construct a convolutional autoencoder network to learn deep features:
[0045] An autoencoder deep convolutional network model is constructed, consisting of an encoder and a decoder. The structure is as follows: input layer → encoder → attention mechanism module → decoder → output layer. The encoder contains three identical encoding layers, and the decoding layer structure is: first convolutional layer → first normalization layer → second convolutional layer → second normalization layer → third convolutional layer. The attention mechanism module structure is: module input layer → data preprocessing layer → pooling layer → convolutional layer → normalization layer → module output layer. The decoder contains three decoding layers.
[0046] This embodiment preferably provides the following parameter settings:
[0047] The encoder consists of three convolutional layers with a kernel size of 3*3 and a stride of 1. The number of channels in the convolutional layers of the three encoding layers are set to 20, 30 and 40 respectively.
[0048] The number of feature maps in the input layer and data preprocessing layer of the attention mechanism module is set to 1; the number of convolutional layers is set to 1, the number of channels is set to 1, the kernel size is 3*3, and the stride is set to 1.
[0049] The decoder consists of three decoding layers, each consisting of a single deconvolutional layer with a kernel size of 3*3 and a stride of 1. The number of channels in the deconvolutional layers of the three decoding layers are set to 30, 20 and 1 respectively.
[0050] Output the final category for each pixel.
[0051] Step F. Train the convolutional network constructed above:
[0052] The training dataset is input into the convolutional network model to obtain a trained deep convolutional autoencoder network model.
[0053] The training dataset is used as the input to the convolutional network model of this invention. The model extracts the features of each pixel in the dataset. The result of the forward propagation of the model is used as the output of the model. By solving the error between the above output and the original input image and backpropagating the error, the network parameters of the scattering convolutional autoencoder network model are optimized, and the trained convolutional autoencoder network model is obtained.
[0054] Step G. Input the test dataset into the trained convolutional network model to obtain the detection results of the test data;
[0055] Step H. Perform anomaly detection on the output of the convolutional network by combining the real ground map. The specific anomaly detection method is to calculate the Mahalanobis distance between the original input data and the model output, and detect anomalies by the difference value.
[0056] Step I. Compare the predicted detection results with the actual ground cover markers. The ratio of the total number of correctly detected pixels to the total number of pixels in the test sample is taken as the overall detection accuracy of the hyperspectral image;
[0057] Step J. In this embodiment, red and black are used as the base colors in the hyperspectral image after detection. The abnormal information is red and the background information is black to obtain the detection result image after coloring. The detection result image after coloring is then output.
[0058] The effects of the present invention will be further explained below with reference to simulation experiments.
[0059] 1. Simulation conditions:
[0060] The simulation experiments of this invention were conducted in a hardware environment with a CPU clock speed of 1.6GHz, 8G memory, MX150 graphics card, and Windows 10, and a software environment with PyCharm 3.6 CPU version.
[0061] 2. Simulation content:
[0062] This includes 1) traditional RX anomaly detection methods; 2) deep learning AE anomaly detection methods; and 3) the method described in this invention, namely, the autoencoder-based hyperspectral anomaly detection method based on residual attention mechanism. Among these, traditional RX anomaly detection methods and deep learning AE anomaly detection methods are both classic methods that are frequently used in hyperspectral anomaly detection.
[0063] Figure 2 This is a pseudo-color image of the Italian Viareggio hyperspectral data used in the simulation described in this embodiment. It has 127 spectral bands and a scene size of 450×375. Figure 3 These are the actual ground feature markers in the hyperspectral images used in this embodiment. According to Figure 3 Six percent of the real ground feature markers were randomly selected as training samples, and the overall data was used as test data. The methods and results of the simulation experiment are shown in Table 1.
[0064] Simulation 1: Using traditional RX anomaly detection methods for... Figure 2 Anomaly detection was performed; the results are shown below. Figure 4 .
[0065] Simulation 2: Using Deep Learning-Based Anomaly Detection Methods for AE Figure 2 Anomaly detection was performed; the results are shown below. Figure 5 .
[0066] Simulation 3: Using this invention to... Figure 2 Anomaly detection was performed; the results are shown below. Figure 6 .
[0067] Table 1. Accuracy of classification results between existing methods and the method of this invention.
[0068]
[0069] 3. Results Analysis:
[0070] From Table 1 and Figure 4-6 As can be seen, the accuracy rate of the traditional RX anomaly detection method is 79.85%; the accuracy rate of the deep learning AE anomaly detection method is 82.06%; and the accuracy rate of the method described in this invention is 84.21%. It is evident that the method described in this invention achieves the highest accuracy rate. The detection results of the method described in this invention are superior to both the traditional RX anomaly detection method and the deep learning AE anomaly detection method in both accuracy and visual effect. Furthermore, the method described in this invention is more comprehensive in detecting subtle anomalies than both the traditional RX anomaly detection method and the deep learning AE anomaly detection method, detecting more anomaly points. This fully demonstrates that the method described in this invention has better hyperspectral anomaly detection performance.
[0071] The above simulation analysis proves the correctness and effectiveness of the method proposed in this invention.
[0072] The parts of this invention not described in detail are common knowledge to those skilled in the art.
[0073] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Obviously, those skilled in the art, after understanding the content and principle of the present invention, may make various modifications and changes in form and detail without departing from the principle and structure of the present invention. However, these modifications and changes based on the concept of the present invention are still within the scope of protection of the claims of the present invention.
Claims
1. A method for detecting hyperspectral anomalies based on an autoencoder using a residual attention mechanism, characterized in that, Includes the following steps: (1) Input the original hyperspectral image and preprocess it to obtain the denoised hyperspectral image. Then, it is serialized to obtain a spectral sequence; where These represent the number of rows and columns in the hyperspectral image, respectively. Indicates the first spectral vectors Indicates the number of spectral channels; (2) Based on the real ground cover map, 5-8% of the data in the denoised hyperspectral image are randomly selected as training samples, and the remaining data are used as test samples to form training dataset and test dataset respectively. (3) Construct an autoencoder deep convolutional network model containing an encoder and a decoder, with the structure as follows: input layer → encoder → attention mechanism module → decoder → output layer, wherein the encoder is a multi-layer convolutional structure; the input layer uses the spectral sequence as the original input information, and the output layer is used to output the reconstructed background image; the encoder contains three coding layers with the same structure, and a residual module is inserted between the second coding layer and the third coding layer; and multi-layer convolution is used in each coding layer to obtain data features, and all the obtained data features are transmitted to the attention mechanism module; the three coding layers with the same structure have the following structure: first convolutional layer → first normalization layer → second convolutional layer → second normalization layer → third convolutional layer; (4) Use the training dataset as the input of the model constructed in step (3), use the model to extract the features of each pixel of the training sample, use the result of the forward propagation of the model as the output of the model, solve the error between the output and the original input image and backpropagate the error to achieve parameter optimization and obtain the trained deep convolutional autoencoder network model. (5) Input the test dataset into the trained deep convolutional autoencoder network model to obtain the prediction detection results of the test data; (6) Perform anomaly detection on the prediction detection results output by the deep convolutional autoencoder network model by combining the real ground feature map; (7) Compare the predicted detection results with the actual ground cover markers and calculate the overall detection accuracy of the hyperspectral image; (8) On the hyperspectral image after detection, two different colors are used as base colors to color the abnormal information and background information respectively, and the final detection result image is obtained and output.
2. The method according to claim 1, characterized in that: The preprocessing mentioned in step (1) refers to first processing the image to be detected through multilinear regression to remove residual stripe noise, and then using noise whitening to normalize the noise variance to achieve image denoising.
3. The method according to claim 1, characterized in that: The encoder consists of three convolutional layers, each with a kernel size of 3*3 and a stride of 1. The number of channels in the convolutional layers of the three encoding layers are set to 20, 30 and 40 respectively.
4. The method according to claim 1, characterized in that: The attention mechanism module in step (3) adopts the ECA attention mechanism. The input is the data features encoded by the encoder, and the output is the latent features selected by the ECA attention mechanism. The module structure is as follows: Module input layer → Data preprocessing layer → Pooling layer → Convolutional layer → Normalization layer → Module output layer.
5. The method according to claim 1, characterized in that: The number of feature maps in the module's input layer and data preprocessing layer is set to 1; the number of convolutional layers is set to 1, the number of channels is 1, the convolutional kernel size is 3*3, and the sliding stride is 1.
6. The method according to claim 1, characterized in that: The decoder described in step (3) consists of three decoding layers; the input of the decoder is the latent features selected by the attention mechanism, and the output is the reconstructed image features.
7. The method according to claim 6, characterized in that: The decoder consists of three decoding layers, each composed of a single deconvolutional layer with a kernel size of 3*3 and a stride of 1. The number of channels in the deconvolutional layers of the three decoding layers are set to 30, 20, and 1, respectively.
8. The method according to claim 1, characterized in that: The anomaly detection described in step (6) specifically involves calculating the Mahalanobis distance between the original input data and the model output, and detecting anomalies through the difference value.
9. The method according to claim 1, characterized in that: In step (7), the overall detection accuracy of the hyperspectral image is calculated by comparing the number of correctly detected pixels with the total number of test sample pixels.
Citation Information
Patent Citations
Self-adaptive semantic segmentation method based on chain type residual error and attention mechanism
CN113569881A
Hyperspectral image classification method based on full convolutional neural network
CN113642445A