Abnormal target detection method, model training method, electronic device and storage medium
Feature extraction and reconstruction of hyperspectral images through the autoencoding network model, and using the second norm regular term constraint, the accuracy problem of the existing hyperspectral image anomaly detection algorithm when the data does not meet the Gaussian distribution is solved, and the improvement is achieved High detection accuracy.
Patent Information
- Application Number
- CN202111646137.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-12-29
AI Technical Summary
The existing hyperspectral image anomaly detection algorithm has the problem of low detection accuracy in practical applications, especially when the data does not meet the Gaussian distribution, the detection effect of the RX algorithm is reduced, the LRSR algorithm cannot perform dimensionality reduction and feature extraction, and the CRD algorithm Detection accuracy decreases when abnormal samples exist in concentric double windows.
The hyperspectral image is extracted using the autoencoding network model. Through the second normal term constraint in the loss function, the hyperspectral image is output to weaken the abnormal information, and the residual image is drawn to indicate the abnormal target distribution.
The accuracy of abnormal detection of hyperspectral images is improved, and by reconstructing the residual image between the hyperspectral image and the original image, it clearly distinguishes background information and abnormal information, achieving higher detection accuracy.
Smart Images

Figure CN114494900B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of remote sensing technology, and in particular to an abnormal target detection method, a model training method, an electronic device and a storage medium. Background Art
[0002] With the research and development of remote sensing science, traditional optical imaging technology can no longer meet the application needs of various fields, and hyperspectral imaging technology has emerged. Hyperspectral imaging technology can combine traditional optical imaging technology with spectral technology, and can detect both the two-dimensional spatial information of the target object and the one-dimensional spectral information corresponding to the two-dimensional spatial information. Therefore, the hyperspectral image contains three-dimensional data with a spectral resolution of 10 -2 So through hyperspectral images, we can discover things that were previously invisible or imperceptible.
[0003] In recent years, many anomaly detection algorithms based on hyperspectral images have been proposed, which can be used to detect abnormal targets, such as the RX algorithm (Reed-Xiaoli), the LRSR algorithm (Low-Rank and Sparse Representation), and the CRD algorithm (Collaborative-Representation-Based Detector), etc.
[0004] Among them, the RX algorithm needs to assume that the hyperspectral image data obeys the Gaussian distribution in order to achieve high detection accuracy, but this condition is not necessarily met in actual situations. When it does not obey the Gaussian distribution, the detection accuracy will be reduced. The LRSR algorithm cannot reduce the dimension of the hyperspectral image data and cannot extract features well, which will also reduce the detection accuracy. In the anomaly detection process of the CRD algorithm, it is necessary to set concentric double windows for the hyperspectral image data. If there are abnormal samples of the same type as the center of the window between the double windows, the detection accuracy will also be reduced.
[0005] In summary, all current hyperspectral image anomaly detection algorithms have certain limitations, which makes the accuracy of hyperspectral image anomaly detection low. Summary of the invention
[0006] In view of the above problems, an abnormal target detection method, a model training method, an electronic device and a storage medium according to an embodiment of the present invention are proposed to solve the problem of low accuracy of anomaly detection in hyperspectral images.
[0007] In a first aspect, a method for detecting an abnormal target is provided, the method comprising:
[0008] Acquire a two-dimensional hyperspectral image corresponding to the target scene to be detected; the two-dimensional hyperspectral image includes initial spatial feature information of different spectral bands;
[0009] The initial spatial feature information of each spectral band in the two-dimensional hyperspectral image is respectively input into the autoencoder network model, so as to output the reconstructed spatial feature information of each spectral band through the autoencoder network model, and the reconstructed spatial feature information of each spectral band constitutes a reconstructed hyperspectral image; the autoencoder network model has a loss function, and the loss function includes a second norm regularization term;
[0010] A residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image is plotted to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene.
[0011] Optionally, the autoencoding network model includes an input layer, a hidden layer and an output layer, the dimension of the hidden layer is smaller than the dimension of the input layer, and the dimension of the input layer is the same as the dimension of the output layer.
[0012] Optionally, the loss function is a square loss function.
[0013] Optionally, the drawing of the residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image to obtain an abnormal target distribution map indicating the distribution of abnormal targets in the target scene includes:
[0014] Performing Euclidean distance calculation on pixel points at the same position in the two-dimensional hyperspectral image and the reconstructed hyperspectral image;
[0015] A residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image is drawn with the Euclidean distance of each pixel point as a pixel value to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene.
[0016] Optionally, obtaining a two-dimensional hyperspectral image corresponding to a target scene to be detected includes:
[0017] Photographing a target scene to be detected to obtain a three-dimensional original hyperspectral image corresponding to the target scene;
[0018] The original hyperspectral image is subjected to standardization preprocessing to obtain a two-dimensional hyperspectral image corresponding to the target scene.
[0019] In a second aspect, a model training method is provided for training the autoencoder network model in the abnormal target detection method according to the first aspect, the method comprising:
[0020] Constructing an initial autoencoder network model; the initial autoencoder network model includes a loss function, and the loss function includes a second norm regularization term;
[0021] Acquire a training sample set; the training sample set includes a plurality of three-dimensional original hyperspectral image training samples; the plurality of three-dimensional original hyperspectral image training samples are obtained by photographing different first scenes;
[0022] The original hyperspectral image training samples are preprocessed to obtain two-dimensional hyperspectral image training samples corresponding to the first scene; the two-dimensional hyperspectral image training samples include initial spatial feature information training samples of different spectral bands;
[0023] The initial autoencoder network model is trained by using each of the two-dimensional hyperspectral image training samples to obtain a trained autoencoder network model.
[0024] Optionally, after the initial autoencoder network model is trained by using the two-dimensional hyperspectral image training samples to obtain the trained autoencoder network model, the method further comprises:
[0025] Acquire a test sample set; the test sample set includes a plurality of three-dimensional original hyperspectral image test samples and abnormal target distribution map test samples corresponding to the original hyperspectral image test samples; the plurality of three-dimensional original hyperspectral image test samples are obtained by photographing different second scenes, and the abnormal target distribution map test samples are used to indicate the real distribution of abnormal targets in the second scene;
[0026] The preprocessing is performed on the original hyperspectral image test sample to obtain a two-dimensional hyperspectral image test sample corresponding to the second scene; the two-dimensional hyperspectral image test sample includes spatial feature information test samples of different spectral bands;
[0027] The trained autoencoder network model is tested by using each of the two-dimensional hyperspectral image test samples.
[0028] Optionally, testing the trained autoencoder network model by using each of the two-dimensional hyperspectral image test samples comprises:
[0029] Inputting the spatial feature information test samples of each spectral band in the two-dimensional hyperspectral image test samples into the trained autoencoder network model respectively, so as to output the reconstructed spatial feature information result samples of each spectral band through the autoencoder network model, and the reconstructed spatial feature information result samples of each spectral band constitute the reconstructed hyperspectral image result samples;
[0030] Plotting a residual image between the two-dimensional hyperspectral image test sample and the reconstructed hyperspectral image result sample to obtain an abnormal target distribution map result sample indicating a predicted distribution of abnormal targets in the second scene;
[0031] Determining evaluation parameters for the trained autoencoder network model according to the abnormal target distribution map result sample and the abnormal target distribution map test sample;
[0032] When the evaluation parameters meet the preset conditions, the test of the trained autoencoder network model is completed.
[0033] Optionally, determining evaluation parameters of the trained autoencoder network model according to the abnormal target distribution map result sample and the abnormal target distribution map test sample includes:
[0034] Draw a receiver operating characteristic curve according to the abnormal target distribution map result sample and the abnormal target distribution map test sample;
[0035] Determining the area under the curve of the receiver operating characteristic curve to obtain evaluation parameters of the trained autoencoder network model;
[0036] When the evaluation parameter satisfies the preset condition, the test of the trained autoencoder network model is completed, including:
[0037] When the area under the curve is greater than or equal to a preset threshold, the test of the trained autoencoder network model is completed.
[0038] In a third aspect, a device for detecting an abnormal target is provided, the device comprising:
[0039] A first acquisition module is used to acquire a two-dimensional hyperspectral image corresponding to a target scene to be detected; the two-dimensional hyperspectral image includes initial spatial feature information of different spectral bands;
[0040] A reconstruction module, used for inputting the initial spatial feature information of each spectral band in the two-dimensional hyperspectral image into the autoencoder network model respectively, so as to output the reconstructed spatial feature information of each spectral band through the autoencoder network model, and the reconstructed spatial feature information of each spectral band constitutes a reconstructed hyperspectral image; the autoencoder network model has a loss function, and the loss function includes a second norm regularization term;
[0041] The drawing module is used to draw a residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene.
[0042] In a fourth aspect, a model training device is provided for training the autoencoder network model in the abnormal target detection method according to the first aspect, the device comprising:
[0043] A construction module, used to construct an initial autoencoder network model; the initial autoencoder network model includes a loss function, and the loss function includes a second norm regularization term;
[0044] A second acquisition module is used to acquire a training sample set; the training sample set includes a plurality of original hyperspectral image training samples; the plurality of three-dimensional original hyperspectral image training samples are obtained by photographing different first scenes;
[0045] A first preprocessing module is used to perform the preprocessing on the original hyperspectral image training samples to obtain two-dimensional hyperspectral image training samples corresponding to the first scene; the two-dimensional hyperspectral image training samples include initial spatial feature information training samples of different spectral bands;
[0046] The training module is used to train the initial autoencoder network model through each of the two-dimensional hyperspectral image training samples to obtain a trained autoencoder network model.
[0047] In a fifth aspect, an electronic device is provided, comprising a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the abnormal target detection method as described in the first aspect, or the at least one instruction is used to be executed by the processor to implement the model training method as described in the second aspect.
[0048] In a sixth aspect, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the abnormal target detection method as described in the first aspect, or the at least one instruction is used to be executed by a processor to implement the model training method as described in the second aspect.
[0049] In an embodiment of the present invention, a two-dimensional hyperspectral image corresponding to the target scene to be detected is first obtained, and the two-dimensional hyperspectral image includes initial spatial feature information of different spectral bands. Then, the initial spatial feature information of each spectral band in the two-dimensional hyperspectral image is respectively input into the autoencoder network model, and the reconstructed spatial feature information of each spectral band is output through the autoencoder network model to obtain a reconstructed hyperspectral image. Then, a residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image is drawn to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene. Among them, the loss function of the autoencoder network model includes a second norm regularization term. In an embodiment of the present invention, the acquired two-dimensional hyperspectral image can be feature extracted by the autoencoder network model, and the second norm constraint is applied to the loss function of the autoencoder network model, so that the output reconstructed hyperspectral image can be more inclined to the distribution of background information, while weakening the abnormal information. In this way, the distribution map for indicating abnormal targets in the target scene can be obtained by the residual image between the reconstructed hyperspectral image and the two-dimensional hyperspectral image, so as to realize abnormal target detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a flowchart of an abnormal target detection method provided by an embodiment of the present invention;
[0051] Figure 2 It is a schematic diagram of reducing the dimension of a three-dimensional original hyperspectral image provided by an embodiment of the present invention;
[0052] Figure 3 is a schematic diagram of an autoencoding network model provided by an embodiment of the present invention;
[0053] Figure 4 It is a flowchart of an abnormal target detection method provided by an embodiment of the present invention;
[0054] Figure 5 It is a flowchart of a model training method provided by an embodiment of the present invention;
[0055] Figure 6 is a block diagram of an abnormal target detection device provided by an embodiment of the present invention;
[0056] Figure 7 It is a block diagram of a model training device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0057] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0058] Before describing the embodiments of the present invention, the RX algorithm, LRSR algorithm and CRD algorithm for anomaly detection in hyperspectral images are first introduced, and the reasons why the detection accuracy of these three algorithms is limited are analyzed.
[0059] (1) RX algorithm
[0060] The RX algorithm is a classic anomaly detection algorithm for hyperspectral images. It is based on the normal model and distinguishes background information and abnormal target information by calculating the mean and covariance of two data, namely the background, and sets a threshold as a judgment indicator. The calculation result is compared with the threshold to determine whether it is an abnormal value, that is, the Mahalanobis distance between the sample to be detected and the background population is calculated. The algorithm assumes that the experimental data follows a Gaussian distribution, that is, Gaussian anomaly detection based on the generalized likelihood ratio divides the image data into abnormal targets and background information. The similarity between the abnormal target and the background information is the main judgment method. The binary hypothesis of the RX algorithm to distinguish targets is defined as follows:
[0061]
[0062] Where H0 represents the assumption that the target does not exist, in which case a=0. When a>0, H1 represents the assumption that the target exists, and n represents the background noise vector; s=[s1,s2,…,s l ] T is the target spectral vector, l represents the spectral dimension of the hyperspectral image, and since the target spectral vector s and the background covariance C b are all unknown. According to the Gaussian distribution model, the covariance of the background and the outliers should be the same, but the means are different. However, in actual hyperspectral images, the covariance of the outliers is not necessarily the same as that of the background. Therefore, it is necessary to assume that the background and the outliers have the same covariance and different means. The expression of the RX algorithm is simplified as follows:
[0063]
[0064] Among them, r is the observed data, is the background mean, is the background covariance, and η is the decision threshold. It can be seen that the above formula calculates the Mahalanobis distance, which is used to describe the difference between the background information and the distribution of abnormal points. The difference is compared with the threshold to determine whether it is an abnormal target.
[0065] Since the RX algorithm needs to assume that the data obeys the Gaussian distribution, in the actual anomaly detection process, the anomaly detection effect is poor for image data that does not satisfy the Gaussian distribution.
[0066] (2)LRSR algorithm
[0067] The LRSR algorithm is also a traditional hyperspectral image anomaly detection algorithm. It uses these two characteristics to detect anomalies in hyperspectral images: the probability of anomalies appearing in anomaly detection is relatively small, and they occupy a very small part of the entire image, showing sparsity, while the background usually has a low-rank characteristic. Since background information has similarity, that is, background information can be represented by other background information, the image data X can be divided into background information and anomaly information, as shown below:
[0068] X=DS+E (3)
[0069] Among them, DS represents the background part, D=[d1,d2...d m ] is the background dictionary formed by background pixels (m is the total number of atoms in the dictionary), S = [s1, s2...s m ] represents the coefficient, E=[e1,e2…e N ] indicates the remaining part corresponding to the exception.
[0070] Due to the low rank nature of background information, it is relatively easy to obtain the background dictionary, so the information is mainly reconstructed by constructing the background dictionary. Abnormal targets are difficult to express using the background dictionary, which will lead to a relatively large reconstruction error. The error value of the background information after being constructed by the background dictionary is relatively small, so whether it is an abnormal target can be determined based on the size of the reconstruction error.
[0071] However, the LRSR algorithm cannot reduce the dimension of data, is not suitable for feature extraction, and requires learning two low-rank matrices, which results in a failure to obtain a global optimal solution. In addition, when there are insufficient training samples, the anomaly detection effect is poor.
[0072] (3)CRD algorithm
[0073] The CRD algorithm is an unsupervised method for estimating pixel weights in a spatial neighborhood. It detects abnormal targets by solving the second norm minimization problem. In the algorithm, two concentric double windows are set for the image data. The background samples between the two windows are used to linearly represent the central sample to be tested. If the difference between the approximate value after linear representation and the original sample to be tested is small, it means that the sample to be tested is the background sample. If the difference is large, it means that it is an abnormal sample, so as to distinguish between background information and abnormal targets.
[0074] The pixel to be detected is y, which is the center of the double window, and X s (size is p×s) is the spatial neighborhood pixel of the pixel to be detected, p is the dimension of the spectrum, and the sizes of the two windows are w out and w in , we know that s = w out × out -w in × inThe goal of collaborative representation is to find the weight vector Make The smallest is also the smallest. Therefore, the objective function is expressed as follows:
[0075]
[0076] Among them, λ is the Lagrange multiplier, the approximate value of the pixel to be detected It is expressed as: Then calculate the Euclidean distance between the pixel to be detected and its approximate value: If r1 is greater than the threshold, y is an abnormal pixel; otherwise, y is a background pixel.
[0077] It can be seen that the CRD algorithm determines whether the sample to be tested is an abnormal target by calculating the approximate value of the sample between the two windows to represent the sample to be tested. However, the CRD algorithm also has certain limitations, that is, when the sample between the two windows itself contains many abnormal samples, when it is used to linearly represent the sample at the center of the window, if the sample at the center of the window is also an abnormal sample, the difference in the approximate value represented will not be very large, that is, it is impossible to determine whether the sample at the center of the window is an abnormal target, so the abnormal detection effect in this case is poor.
[0078] Reference Figure 1 , shows a flow chart of an abnormal target detection method according to an embodiment of the present invention, and the abnormal target detection method may specifically include the following steps:
[0079] Step 101: obtaining a two-dimensional hyperspectral image corresponding to a target scene to be detected; the two-dimensional hyperspectral image includes initial spatial feature information of different spectral bands.
[0080] In the present invention, the three-dimensional original hyperspectral image obtained by shooting is an image cube of two-dimensional space and one-dimensional spectrum. In the image space, each spectral band corresponds to a two-dimensional spectral image, and in the spectral space, each pixel is reflected as a continuous spectral response curve. Different substances appear as different radiation intensities in the original hyperspectral image. It has the characteristics of many bands and narrow band width, so it can continuously image the same target object.
[0081] Since the original three-dimensional hyperspectral image has the characteristics of large data volume and high dimensionality, it is necessary to reduce the dimension before performing anomaly detection on it, and then the features can be well extracted. Therefore, optionally, this step can be specifically implemented in the following ways: photographing the target scene to be detected to obtain the original three-dimensional hyperspectral image corresponding to the target scene; performing standardization preprocessing on the original hyperspectral image to obtain the two-dimensional hyperspectral image corresponding to the target scene.
[0082] In the embodiment of the present invention, the captured three-dimensional original hyperspectral image can be preprocessed to destroy its three-dimensional spatial structure, so as to obtain a two-dimensional hyperspectral image after dimensionality reduction, wherein the preprocessing can specifically adopt standardized preprocessing.
[0083] In the process of standardization preprocessing, the original three-dimensional hyperspectral image with the size of (a, b, c) can be first converted into an initial two-dimensional hyperspectral image with the size of (a×b, c). Figure 2 , a is the length of the original hyperspectral image, b is the width of the original hyperspectral image, and c is the spectral band dimension of the original hyperspectral image, that is, the number of spectral bands. For the converted initial two-dimensional hyperspectral image, a×b is its length and c is its width, that is, the two-dimensional spectral image of a spectral band in the three-dimensional original hyperspectral image can be converted into a row of data. Then, each pixel value (original pixel value) in the initial two-dimensional hyperspectral image can be standardized and calculated to obtain a new pixel value, thereby achieving smooth noise processing for the initial two-dimensional hyperspectral image, and obtaining the two-dimensional hyperspectral image in step 101. In a two-dimensional hyperspectral image, the initial spatial feature information of a spectral band is also a row of data in the two-dimensional hyperspectral image.
[0084] Among them, the normalization calculation of pixel values can be achieved by the following formula:
[0085]
[0086] In this formula, for any pixel A, is the new pixel value of pixel A, x is the original pixel value of pixel A, is the average pixel value of the pixel row where pixel A is located, and σ is the standard deviation of the original pixel value of the pixel row where pixel A is located.
[0087] The two-dimensional hyperspectral image obtained after dimensionality reduction and smooth noise processing includes the initial spatial feature information of different spectral bands. It should be noted that since the pixel values have been standardized, the initial spatial feature information in the two-dimensional hyperspectral image is different from the original spatial feature information of the three-dimensional original hyperspectral image.
[0088] Step 102: inputting the initial spatial feature information of each spectral band in the two-dimensional hyperspectral image into the autoencoder network model respectively, so as to output the reconstructed spatial feature information of each spectral band through the autoencoder network model, and the reconstructed spatial feature information of each spectral band constitutes the reconstructed hyperspectral image; the autoencoder network model has a loss function, and the loss function includes a second norm regularization term.
[0089] In this step, after preprocessing, each row of data in the two-dimensional hyperspectral image can be input into a preset autoencoder network model, and the autoencoder network model can output the reconstructed spatial feature information of each spectral band. The reconstructed spatial feature information of a spectral band is taken as a row of data, and multiple rows of data are arranged along the column direction to form a reconstructed hyperspectral image.
[0090] Reference Figure 3 , shows a schematic diagram of an autoencoding network model of an embodiment of the present invention, wherein the autoencoding network model may include an input layer, a hidden layer and an output layer, the dimension of the hidden layer is smaller than the dimension of the input layer, and the dimension of the input layer is the same as the dimension of the output layer.
[0091] exist Figure 3 In the figure, the circles represent neurons and the input data x i represents the spatial feature information of the i-th spectral segment of the original hyperspectral image, B represents the spectral dimension of the original hyperspectral image, that is, the number of spectral segments. The input data of the autoencoder network model is the spatial feature information of each spectral dimension, and the output data y i is the reconstructed spatial feature information of each spectral dimension. The loss function is used to calculate the reconstruction error.
[0092] Among them, from the input layer to the hidden layer corresponds to the encoding function, also known as the compression process. Since the input data itself has different degrees of redundant information, the autoencoder network model removes these redundant features through learning, retains important features (that is, feature extraction), and inputs the important features into the hidden layer. From the hidden layer to the output layer corresponds to the decoding function, also known as the decompression process. The autoencoder network model reconstructs the input data to a certain extent based on the important features.
[0093] In the embodiment of the present invention, the dimension of each layer refers to the number of neurons included in each layer. The dimension of the hidden layer is smaller than the dimension of the input layer, that is, the number of neurons included in the hidden layer is smaller than the number of neurons included in the input layer. Therefore, the encoding process in the embodiment of the present invention is a dimensionality reduction operation, that is, the autoencoder network model attempts to describe the input data with a smaller dimension without losing important information as much as possible. The dimension of the input layer is the same as the dimension of the output layer, that is, the number of neurons included in the input layer is equal to the number of neurons included in the output layer, so that the reconstructed data with the same dimension as the input data can be achieved.
[0094] In addition, in the embodiment of the present invention, the autoencoder network model has a loss function, and the loss function includes a second norm regularization term, wherein the second norm regularization term is also called an L2 regularization term.
[0095] The loss function is also called the cost function. In machine learning, it usually refers to the error between the original data (i.e., input data) and the reconstructed data (i.e., output data). The smaller the reconstruction error, the stronger the model's ability to reconstruct the original data.
[0096] However, in the embodiment of the present invention, since anomaly detection is required, the output image obtained after reconstruction (that is, the reconstructed hyperspectral image in the embodiment of the present invention) should be background information as much as possible, that is, the characteristics of the abnormal target are not obvious. In this way, when the output image is compared with the input image (that is, the two-dimensional hyperspectral image in the embodiment of the present invention), the difference between the two will be very obvious, that is, the detection effect is better, that is, the present invention needs to reconstruct the background features of the input data, rather than all the features.
[0097] Therefore, in an embodiment of the present invention, a second norm regularization term can be added to the loss function of the autoencoder network model to penalize the loss function. The second norm regularization term has the function of smoothing the data, which can make the output image after reconstruction based on the extracted features more obedient to the distribution of the background information. In the training process of the autoencoder network model, through the back propagation characteristics of the autoencoder network model, the parameters of the autoencoder network model can be adjusted according to the size of the reconstruction error calculated by the loss function constrained by the second norm. Therefore, the embodiment of the present invention trains the autoencoder network model through the loss function constrained by the second norm, minimizes the reconstruction error, and makes the output image of the trained autoencoder network model more obedient to the distribution of the background information, and will not reconstruct abnormal targets in the input image.
[0098] It should be noted that, since the second norm regularization term has the function of smoothing data, the second norm regularization term is usually used to prevent model overfitting. However, in the embodiment of the present invention, in order to make the output image more obedient to the distribution of background information, thereby producing a clear distinction between abnormal targets and the input image, the parameter setting of the second norm regularization term is mainly to meet the needs of evaluating the accuracy of abnormality detection of the model. In actual application, preventing model overfitting can be achieved through other regularization terms or even regularization processing methods, and of course it can also be achieved through the second norm regularization term. The embodiment of the present invention does not make specific limitations on this.
[0099] In some optional embodiments, the loss function may be a squared loss function.
[0100] By using the square loss function, the autoencoder network model can have a certain reconstruction ability, so that it can reconstruct input data that is more in line with the background information distribution. It can also limit the reconstruction ability of the autoencoder network model to prevent the autoencoder network model from accurately reconstructing the characteristics of abnormal targets. In addition, the operation is also simpler.
[0101] Step 103: Plotting a residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene.
[0102] In an embodiment of the present invention, this step can be specifically implemented in the following manner, including: performing Euclidean distance calculation on pixel points at the same position in the two-dimensional hyperspectral image and the reconstructed hyperspectral image; drawing a residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image using the Euclidean distance of each pixel point as a pixel value, and obtaining an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene.
[0103] The two-dimensional hyperspectral image is reconstructed by the autoencoder network model. After obtaining the reconstructed hyperspectral image, the Euclidean distance between the pixel values of the corresponding pixel points in the reconstructed hyperspectral image and the two-dimensional hyperspectral image can be calculated, and the calculation result is used as the pixel value to draw the residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image. In the residual image, the pixels with a larger Euclidean distance are abnormal pixels, and the distribution of abnormal pixels is also the distribution of abnormal targets in the two-dimensional hyperspectral image. Therefore, the residual image is also the abnormal target distribution map corresponding to the target scene.
[0104] Figure 4 A specific flow chart of an abnormal target detection method according to an embodiment of the present invention is shown. Figure 4 , the autoencoder network can perform nonlinear dimensionality reduction on the preprocessed two-dimensional hyperspectral image, and then extract features in the hidden layer, and impose the second norm constraint on the loss function, so that the output reconstructed hyperspectral image is more inclined to the distribution of background information, and then the residual image between the reconstructed hyperspectral image and the two-dimensional hyperspectral image is drawn to obtain the abnormal target distribution map corresponding to the original hyperspectral image. By comparing the detection results with the three current anomaly detection algorithms mentioned above, it can be concluded that the hyperspectral image abnormal target detection method based on the autoencoder network provided in the embodiment of the present invention has a good detection effect.
[0105] In an embodiment of the present invention, a two-dimensional hyperspectral image corresponding to the target scene to be detected is first obtained, and the two-dimensional hyperspectral image includes initial spatial feature information of different spectral bands. Then, the initial spatial feature information of each spectral band in the two-dimensional hyperspectral image is respectively input into the autoencoder network model, and the reconstructed spatial feature information of each spectral band is output through the autoencoder network model to obtain a reconstructed hyperspectral image. Then, a residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image is drawn to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene. Among them, the loss function of the autoencoder network model includes a second norm regularization term. In an embodiment of the present invention, the acquired two-dimensional hyperspectral image can be feature extracted by the autoencoder network model, and the second norm constraint is applied to the loss function of the autoencoder network model, so that the output reconstructed hyperspectral image can be more inclined to the distribution of background information, while weakening the abnormal information. In this way, the distribution map for indicating abnormal targets in the target scene can be obtained by the residual image between the reconstructed hyperspectral image and the two-dimensional hyperspectral image, so as to realize abnormal target detection.
[0106] Reference Figure 5 , shows a flow chart of a model training method according to an embodiment of the present invention, the model training method is used to train the autoencoder network model in the above abnormal target detection method, and the model training method may specifically include the following steps:
[0107] Step 501: construct an initial autoencoder network model; the initial autoencoder network model includes a loss function, and the loss function includes a second norm regularization term.
[0108] In an embodiment of the present invention, the loss function expression of the initial autoencoder network model can be as follows:
[0109]
[0110] in,
[0111] In the above formula (7), w represents the weight coefficient vector, b represents the bias unit, x represents the input data, y represents the reconstructed output data, and h w,b (f(x)) represents the nonlinear mapping of encoding and decoding of the initial autoencoder network model.
[0112] In the above formula (6), x i represents the input hyperspectral image, y i represents the output reconstructed hyperspectral image, m represents the number of training times, n represents the dimension of the hidden layer of the initial autoencoder network model, and the embodiment of the present invention controls the strength of the regularization degree by adjusting the regularization coefficient λ.
[0113] Step 502: Acquire a training sample set; the training sample set includes a plurality of three-dimensional original hyperspectral image training samples; a plurality of three-dimensional original hyperspectral image test samples are obtained by photographing different second scenes, and the abnormal target distribution map test samples are used to indicate the real distribution of abnormal targets in the second scene.
[0114] In an embodiment of the present invention, a training sample set for training an initial autoencoder network model may be obtained, wherein the original hyperspectral image training samples in the training sample set do not need to be labeled.
[0115] Step 503: preprocessing the original hyperspectral image training samples to obtain two-dimensional hyperspectral image training samples corresponding to the first scene; the two-dimensional hyperspectral image training samples include initial spatial feature information training samples of different spectral bands.
[0116] In this step, each original hyperspectral image training sample can be subjected to standardized preprocessing to obtain a two-dimensional hyperspectral image training sample corresponding to each original hyperspectral image training sample, wherein the two-dimensional hyperspectral image training sample includes initial spatial feature information training samples of different spectral bands.
[0117] Step 504: Train the initial autoencoder network model using each two-dimensional hyperspectral image training sample to obtain a trained autoencoder network model.
[0118] In an embodiment of the present invention, optionally, the establishment and training of the model can be implemented by software with model establishment and training functions, in which an initial autoencoding network model can be established, data to be trained can be input, and relevant parameters required for training can be set.
[0119] For example, in a specific embodiment, an initial autoencoder network model can be established by MATLAB software, the encoding_dim parameter (i.e., n in the above formula (6)) is set to 3, the epoch parameter (i.e., m in the above formula (6)) is set to 50, the L2 Weight Regularization parameter (i.e., the regularization coefficient λ in the above formula (6)) is set to 0.004, and the activation function is set to the nonlinear activation function sigmoid. The nonlinear activation function enables the autoencoder network model to perform nonlinear dimensionality reduction on the input data.
[0120] When training the model, the inventors found that the epoch parameter needs to be set to an appropriate value. If it is too small, the training times will be insufficient and it will be difficult to obtain relatively accurate features. If it is too large, it is not necessary, because after the model is trained a certain number of times, its features can almost be extracted. Excessive training times will not improve the results well, but may lead to overfitting. Therefore, multiple experiments are needed to determine a more appropriate epoch value.
[0121] When training the model, the initial spatial feature information training sample of a spectral band is required as an input data, so that the initial autoencoder network model can output the reconstructed spatial feature information of the corresponding spectral band. The initial autoencoder network model uses the back propagation characteristics to adjust the model parameters during the training process, thereby obtaining the trained autoencoder network model.
[0122] During the training process, through the back propagation characteristics of the autoencoder network model, the parameters of the autoencoder network model can be adjusted according to the reconstruction error size calculated by the loss function constrained by the second norm. Therefore, the embodiment of the present invention trains the autoencoder network model through the loss function constrained by the second norm, minimizes the reconstruction error, and makes the output image of the trained autoencoder network model more obedient to the distribution of background information, and does not reconstruct abnormal targets in the input image.
[0123] Optionally, after step 504, the trained autoencoder network model may also be tested, which may be implemented by the following steps 505-507:
[0124] Step 505: Acquire a test sample set; the test sample set includes a plurality of three-dimensional original hyperspectral image test samples and abnormal target distribution map test samples corresponding to the original hyperspectral image test samples; the plurality of three-dimensional original hyperspectral image test samples are obtained by photographing different second scenes, and the abnormal target distribution map test samples are used to indicate the actual distribution of abnormal targets in the second scene.
[0125] Step 506: preprocessing the original hyperspectral image test sample to obtain a two-dimensional hyperspectral image test sample corresponding to the second scene; the two-dimensional hyperspectral image test sample includes spatial feature information test samples of different spectral bands.
[0126] Step 507: Testing the trained autoencoder network model using each two-dimensional hyperspectral image test sample.
[0127] In an embodiment of the present invention, the original hyperspectral image test samples in the test sample set and the original hyperspectral image training samples in the training sample set use different hyperspectral images. In addition to multiple original hyperspectral image test samples, the test sample set also includes abnormal target distribution map test samples corresponding to each original hyperspectral image test sample, which is used to compare with the abnormal target distribution map obtained based on the trained autoencoder network model to evaluate the trained autoencoder network model.
[0128] For the original hyperspectral image test samples, it is still necessary to first perform standardized preprocessing to convert them into two-dimensional images.
[0129] Similar to the input when training the model, when testing the model, a test sample of the spatial feature information of a spectral band is required as an input data, so that the trained autoencoder network model can output the reconstructed spatial feature information of the corresponding spectral band.
[0130] Further optionally, step 507 may specifically include:
[0131] Sub-step 5071: input the spatial feature information test samples of each spectral band in the two-dimensional hyperspectral image test sample into the trained autoencoder network model respectively, so as to output the reconstructed spatial feature information result samples of each spectral band through the autoencoder network model, and the reconstructed spatial feature information result samples of each spectral band constitute the reconstructed hyperspectral image result samples.
[0132] Sub-step 5072: Plotting a residual image between the two-dimensional hyperspectral image test sample and the reconstructed hyperspectral image result sample to obtain an abnormal target distribution map result sample for indicating the predicted distribution of abnormal targets in the second scene.
[0133] Sub-step 5073: Determine evaluation parameters for the trained autoencoder network model according to the abnormal target distribution map result sample and the abnormal target distribution map test sample.
[0134] Sub-step 5074: When the evaluation parameters meet the preset conditions, the test of the trained autoencoder network model is completed.
[0135] Among them, similar to the anomaly detection process above, each row of data in the two-dimensional hyperspectral image test sample (that is, the spatial feature information test sample of each spectral band) can be input into the trained autoencoder network model respectively, and the trained autoencoder network model can output the reconstructed spatial feature information result sample of each spectral band. The reconstructed spatial feature information result sample of a spectral band is taken as a row of data, and multiple rows of data arranged along the column direction are the reconstructed hyperspectral image result samples.
[0136] Then, the Euclidean distance calculation can be performed on the pixel data of the reconstructed hyperspectral image result sample and the pixel data of the two-dimensional hyperspectral image test sample, and the calculation result can be plotted as a residual image between the two-dimensional hyperspectral image test sample and the reconstructed hyperspectral image result sample. The obtained abnormal target distribution map is called the abnormal target distribution map result sample.
[0137] Since the abnormal target distribution map result sample can indicate the predicted distribution of abnormal targets in the second scenario, and the abnormal target distribution map test sample can indicate the true distribution of abnormal targets in the second scenario, the evaluation parameters of the trained autoencoder network model can be determined based on the difference between the abnormal target distribution map result sample and the abnormal target distribution map test sample, that is, the difference between the predicted distribution and the true distribution of abnormal targets in the second scenario. If the evaluation parameter meets the preset conditions, it means that the trained autoencoder network model meets the use requirements, the model test is completed, and the model can be put into use. If the evaluation parameter meets the preset conditions, it means that the trained autoencoder network model does not meet the use requirements, and it is necessary to adjust the training parameters, continue model training, and then test again until the evaluation parameter meets the preset conditions.
[0138] Further optionally, sub-step 5073 may specifically determine the evaluation parameters in the following manners, including:
[0139] Draw a receiver operating characteristic curve based on the abnormal target distribution map result sample and the abnormal target distribution map test sample;
[0140] The area under the receiver operating characteristic curve was determined to obtain evaluation parameters for the trained autoencoder network model.
[0141] First, let's introduce some related concepts of the receiver operating characteristic curve (ROC curve):
[0142] 1. True Positive (TP) is a positive sample predicted by the model as positive;
[0143] 2. False Negative (FN): positive samples predicted as negative by the model;
[0144] 3. False Positive (FP): Negative samples predicted as positive by the model;
[0145] 4. True Negative (TN): negative samples predicted by the model as negative;
[0146] 5. True Positive Rate (TPR): TPR = TP / (TP+FN) (number of positive sample prediction results / actual number of positive samples);
[0147] 6. False Positive Rate (FPR): FPR = FP / (FP+TN) (the number of negative sample results predicted as positive / the actual number of negative samples).
[0148] Among them, the horizontal axis of the ROC curve is the false positive rate, and the vertical axis is the true positive rate.
[0149] In an embodiment of the present invention, the actual number of positive samples and the actual number of negative samples can be obtained from the abnormal target distribution map test sample, and the number of positive sample prediction results and the number of negative sample results predicted to be positive can be obtained from the abnormal target distribution map result sample.
[0150] After the ROC curve is drawn, the area under the ROC curve (AUC) can be determined. The AUC value is the evaluation parameter of the trained autoencoder network model.
[0151] Accordingly, sub-step 5074 specifically includes:
[0152] When the area under the curve is greater than or equal to a preset threshold, the test of the trained autoencoder network model is completed.
[0153] When the determined AUC value is greater than or equal to a preset threshold, it is considered that the evaluation parameter meets the preset condition, and thus the test of the trained autoencoder network model is completed.
[0154] After the test is completed, the anomaly detection process mentioned above can be implemented through the autoencoder network model.
[0155] In an embodiment of the present invention, an initial autoencoder network model can be first constructed, and a training sample set can be obtained. Then, the original hyperspectral image training samples in the training sample set are preprocessed to obtain two-dimensional hyperspectral image training samples. After that, the initial autoencoder network model can be trained by each two-dimensional hyperspectral image training sample. Since a second norm constraint is imposed on the loss function of the initial autoencoder network model, during the model training process, the output reconstructed hyperspectral image can be gradually closer to the distribution of background information, while the abnormal information is gradually weakened. In this way, an autoencoder network model with higher detection accuracy can be trained.
[0156] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0157] Reference Figure 6 , shows a block diagram of an abnormal target detection device 600, and the device 600 may specifically include:
[0158] The first acquisition module 601 is used to acquire a two-dimensional hyperspectral image corresponding to the target scene to be detected; the two-dimensional hyperspectral image includes initial spatial feature information of different spectral bands;
[0159] The reconstruction module 602 is used to input the initial spatial feature information of each spectral band in the two-dimensional hyperspectral image into the autoencoder network model respectively, so as to output the reconstructed spatial feature information of each spectral band through the autoencoder network model, and the reconstructed spatial feature information of each spectral band constitutes a reconstructed hyperspectral image; the autoencoder network model has a loss function, and the loss function includes a second norm regularization term;
[0160] The drawing module 603 is used to draw a residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene.
[0161] Optionally, the autoencoding network model includes an input layer, a hidden layer and an output layer, the dimension of the hidden layer is smaller than the dimension of the input layer, and the dimension of the input layer is the same as the dimension of the output layer.
[0162] Optionally, the loss function is a square loss function.
[0163] Optionally, the drawing module is specifically used for:
[0164] Performing Euclidean distance calculation on pixel points at the same position in the two-dimensional hyperspectral image and the reconstructed hyperspectral image;
[0165] A residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image is drawn with the Euclidean distance of each pixel point as a pixel value to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene.
[0166] Optionally, the first acquisition module is specifically used to:
[0167] Photographing a target scene to be detected to obtain a three-dimensional original hyperspectral image corresponding to the target scene;
[0168] The original hyperspectral image is subjected to standardization preprocessing to obtain a two-dimensional hyperspectral image corresponding to the target scene.
[0169] In an embodiment of the present invention, firstly, a two-dimensional hyperspectral image corresponding to the target scene to be detected is obtained through a first acquisition module, and the two-dimensional hyperspectral image includes initial spatial feature information of different spectral bands. Then, through a reconstruction module, the initial spatial feature information of each spectral band in the two-dimensional hyperspectral image is respectively input into the autoencoder network model, and the reconstructed spatial feature information of each spectral band is output through the autoencoder network model to obtain a reconstructed hyperspectral image. Then, through a drawing module, a residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image is drawn to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene. Among them, the loss function of the autoencoder network model includes a second norm regularization term. In an embodiment of the present invention, the acquired two-dimensional hyperspectral image can be feature extracted through the autoencoder network model, and the second norm constraint is applied to the loss function of the autoencoder network model, so that the output reconstructed hyperspectral image can be more inclined to the distribution of background information, while weakening the abnormal information. In this way, the distribution map for indicating abnormal targets in the target scene can be obtained by reconstructing the residual image between the hyperspectral image and the two-dimensional hyperspectral image, so as to realize abnormal target detection.
[0170] Reference Figure 7 , a block diagram of a model training device 700 is shown, which is used to train the autoencoder network model in the above-mentioned method for detecting abnormal targets in hyperspectral images. The device 700 may specifically include:
[0171] A construction module 701 is used to construct an initial autoencoder network model; the initial autoencoder network model includes a loss function, and the loss function includes a second norm regularization term;
[0172] The second acquisition module 702 is used to acquire a training sample set; the training sample set includes a plurality of original hyperspectral image training samples; the plurality of three-dimensional original hyperspectral image training samples are obtained by photographing different first scenes;
[0173] A first preprocessing module 703 is used to perform the preprocessing on the original hyperspectral image training samples to obtain two-dimensional hyperspectral image training samples corresponding to the first scene; the two-dimensional hyperspectral image training samples include initial spatial feature information training samples of different spectral bands;
[0174] The training module 704 is used to train the initial autoencoder network model through each of the two-dimensional hyperspectral image training samples to obtain a trained autoencoder network model.
[0175] Optionally, the device 700 further includes:
[0176] A third acquisition module is used to acquire a test sample set; the test sample set includes a plurality of three-dimensional original hyperspectral image test samples and an abnormal target distribution map test sample corresponding to the original hyperspectral image test sample; the plurality of three-dimensional original hyperspectral image test samples are obtained by photographing different second scenes, and the abnormal target distribution map test sample is used to indicate the real distribution of abnormal targets in the second scene;
[0177] A second preprocessing module is used to perform the preprocessing on the original hyperspectral image test sample to obtain a two-dimensional hyperspectral image test sample corresponding to the second scene; the two-dimensional hyperspectral image test sample includes spatial feature information test samples of different spectral bands;
[0178] The testing module is used to test the trained autoencoder network model through each of the two-dimensional hyperspectral image test samples.
[0179] Optionally, the test module includes:
[0180] A reconstruction submodule, for inputting the spatial feature information test samples of each spectral band in the two-dimensional hyperspectral image test sample into the trained autoencoder network model, so as to output the reconstructed spatial feature information result samples of each spectral band through the autoencoder network model, and the reconstructed spatial feature information result samples of each spectral band constitute the reconstructed hyperspectral image result samples;
[0181] A drawing submodule, used for drawing a residual image between the two-dimensional hyperspectral image test sample and the reconstructed hyperspectral image result sample, to obtain an abnormal target distribution map result sample indicating a predicted distribution of abnormal targets in the second scene;
[0182] A determination submodule, used to determine evaluation parameters of the trained autoencoder network model according to the abnormal target distribution map result sample and the abnormal target distribution map test sample;
[0183] The evaluation submodule is used to complete the test of the trained autoencoder network model when the evaluation parameters meet the preset conditions.
[0184] Optionally, the determining submodule is specifically used for:
[0185] Draw a receiver operating characteristic curve according to the abnormal target distribution map result sample and the abnormal target distribution map test sample;
[0186] Determining the area under the curve of the receiver operating characteristic curve to obtain evaluation parameters of the trained autoencoder network model;
[0187] The evaluation submodule is specifically used for:
[0188] When the area under the curve is greater than or equal to a preset threshold, the test of the trained autoencoder network model is completed.
[0189] In an embodiment of the present invention, first, an initial autoencoder network model can be constructed through a construction module, and a training sample set can be obtained through a second acquisition module. Then, the original hyperspectral image training samples in the training sample set are preprocessed through a first preprocessing module to obtain two-dimensional hyperspectral image training samples. After that, the training module can train the initial autoencoder network model through each two-dimensional hyperspectral image training sample. Since a second norm constraint is imposed on the loss function of the initial autoencoder network model, during the model training process, the output reconstructed hyperspectral image can be gradually closer to the distribution of background information, while the abnormal information is gradually weakened. In this way, an autoencoder network model with higher detection accuracy can be trained.
[0190] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0191] An embodiment of the present invention also provides an electronic device, comprising a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the abnormal target detection method as described above, or the at least one instruction is used to be executed by the processor to implement the model training method as described above.
[0192] An embodiment of the present invention also provides a computer-readable storage medium, which stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the abnormal target detection method as described above, or the at least one instruction is used to be executed by a processor to implement the model training method as described above.
[0193] In practical applications, the electronic device for implementing the abnormal target detection method and the model training method may be the same electronic device or different electronic devices, which is not limited in the embodiments of the present invention.
[0194] In practical applications, the computer-readable storage medium for implementing the abnormal target detection method and the model training method may be the same computer-readable storage medium or different computer-readable storage media, which is not limited in the embodiments of the present invention.
[0195] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0196] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0197] In a typical configuration, a computer device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. Memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium. Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. According to the definition in this article, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.
[0198] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0199] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0200] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0201] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0202] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0203] The above is a detailed introduction to an abnormal target detection method, a model training method, an electronic device and a storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for detecting abnormal targets, characterized in that: The method comprises: Acquire a two-dimensional hyperspectral image corresponding to the target scene to be detected; the two-dimensional hyperspectral image includes initial spatial feature information of different spectral bands; The initial spatial feature information of each spectral band in the two-dimensional hyperspectral image is respectively input into the autoencoder network model, so as to output the reconstructed spatial feature information of each spectral band through the autoencoder network model, and the reconstructed spatial feature information of each spectral band constitutes a reconstructed hyperspectral image; the autoencoder network model has a loss function, and the loss function includes a second norm regularization term; Drawing a residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene; drawing the residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene, comprises: Performing Euclidean distance calculation on pixel points at the same position in the two-dimensional hyperspectral image and the reconstructed hyperspectral image; A residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image is drawn with the Euclidean distance of each pixel point as a pixel value to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene.
2. The method according to claim 1, characterized in that The step of obtaining a two-dimensional hyperspectral image corresponding to the target scene to be detected includes: Photographing a target scene to be detected to obtain a three-dimensional original hyperspectral image corresponding to the target scene; The original hyperspectral image is subjected to standardization preprocessing to obtain a two-dimensional hyperspectral image corresponding to the target scene.
3. A model training method, characterized in that: The method is used to train the autoencoder network model in the abnormal target detection method according to any one of claims 1 to 2, and the method comprises: Constructing an initial autoencoder network model; the initial autoencoder network model includes a loss function, and the loss function includes a second norm regularization term; Acquire a training sample set; the training sample set includes a plurality of three-dimensional original hyperspectral image training samples; the plurality of three-dimensional original hyperspectral image training samples are obtained by photographing different first scenes; The original hyperspectral image training samples are preprocessed to obtain two-dimensional hyperspectral image training samples corresponding to the first scene; the two-dimensional hyperspectral image training samples include initial spatial feature information training samples of different spectral bands; The initial autoencoder network model is trained by using each of the two-dimensional hyperspectral image training samples to obtain a trained autoencoder network model.
4. The method according to claim 3, characterized in that After the initial autoencoder network model is trained by each of the two-dimensional hyperspectral image training samples to obtain the trained autoencoder network model, the method further includes: Acquire a test sample set; the test sample set includes a plurality of three-dimensional original hyperspectral image test samples and abnormal target distribution map test samples corresponding to the original hyperspectral image test samples; the plurality of three-dimensional original hyperspectral image test samples are obtained by photographing different second scenes, and the abnormal target distribution map test samples are used to indicate the real distribution of abnormal targets in the second scene; The preprocessing is performed on the original hyperspectral image test sample to obtain a two-dimensional hyperspectral image test sample corresponding to the second scene; the two-dimensional hyperspectral image test sample includes spatial feature information test samples of different spectral bands; The trained autoencoder network model is tested by using each of the two-dimensional hyperspectral image test samples.
5. The method according to claim 4, characterized in that The step of testing the trained autoencoder network model by using each of the two-dimensional hyperspectral image test samples comprises: Inputting the spatial feature information test samples of each spectral band in the two-dimensional hyperspectral image test samples into the trained autoencoder network model respectively, so as to output the reconstructed spatial feature information result samples of each spectral band through the autoencoder network model, and the reconstructed spatial feature information result samples of each spectral band constitute the reconstructed hyperspectral image result samples; Plotting a residual image between the two-dimensional hyperspectral image test sample and the reconstructed hyperspectral image result sample to obtain an abnormal target distribution map result sample indicating a predicted distribution of abnormal targets in the second scene; Determining evaluation parameters for the trained autoencoder network model according to the abnormal target distribution map result sample and the abnormal target distribution map test sample; When the evaluation parameters meet the preset conditions, the test of the trained autoencoder network model is completed.
6. The method according to claim 5, characterized in that Determining the evaluation parameters of the trained autoencoder network model according to the abnormal target distribution map result sample and the abnormal target distribution map test sample includes: Draw a receiver operating characteristic curve according to the abnormal target distribution map result sample and the abnormal target distribution map test sample; Determining the area under the curve of the receiver operating characteristic curve to obtain evaluation parameters of the trained autoencoder network model; When the evaluation parameter satisfies the preset condition, the test of the trained autoencoder network model is completed, including: When the area under the curve is greater than or equal to a preset threshold, the test of the trained autoencoder network model is completed.
7. An abnormal target detection device, characterized in that: The device comprises: A first acquisition module is used to acquire a two-dimensional hyperspectral image corresponding to a target scene to be detected; the two-dimensional hyperspectral image includes initial spatial feature information of different spectral bands; A reconstruction module, used for inputting the initial spatial feature information of each spectral band in the two-dimensional hyperspectral image into the autoencoder network model respectively, so as to output the reconstructed spatial feature information of each spectral band through the autoencoder network model, and the reconstructed spatial feature information of each spectral band constitutes a reconstructed hyperspectral image; the autoencoder network model has a loss function, and the loss function includes a second norm regularization term; A drawing module, used for drawing a residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image, to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene; The step of drawing a residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image to obtain an abnormal target distribution map indicating the distribution of abnormal targets in the target scene includes: Performing Euclidean distance calculation on pixel points at the same position in the two-dimensional hyperspectral image and the reconstructed hyperspectral image; A residual image between the two-dimensional hyperspectral image and the reconstructed hyperspectral image is drawn with the Euclidean distance of each pixel point as a pixel value to obtain an abnormal target distribution map for indicating the distribution of abnormal targets in the target scene.
8. A model training device, characterized in that: The device is used to train the autoencoder network model in the abnormal target detection method according to any one of claims 1 to 4, and the device includes: A construction module, used to construct an initial autoencoder network model; the initial autoencoder network model includes a loss function, and the loss function includes a second norm regularization term; A second acquisition module is used to acquire a training sample set; the training sample set includes a plurality of original hyperspectral image training samples; the plurality of three-dimensional original hyperspectral image training samples are obtained by photographing different first scenes; A first preprocessing module is used to perform the preprocessing on the original hyperspectral image training samples to obtain two-dimensional hyperspectral image training samples corresponding to the first scene; the two-dimensional hyperspectral image training samples include initial spatial feature information training samples of different spectral bands; The training module is used to train the initial autoencoder network model through each of the two-dimensional hyperspectral image training samples to obtain a trained autoencoder network model.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the abnormal target detection method as described in any one of claims 1 to 2, or the at least one instruction is used to be executed by the processor to implement the model training method as described in any one of claims 3 to 6.
10. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the abnormal target detection method as described in any one of claims 1 to 2, or the at least one instruction is used to be executed by the processor to implement the model training method as described in any one of claims 3 to 6.
Citation Information
Patent Citations
Hyperspectral anomaly detection method based on S1 / 2 norm low-rank representation model
CN112560975A
Hyperspectral image anomaly detection method
CN113111755A
