An image anomaly recognition method based on a nested residual auto-encoding model

By nesting residual autoencoders and distance metric models, the problem of insufficient feature representation in autoencoders when there is a lack of anomalous sample data is solved, and efficient image anomaly detection is achieved.

CN118115448BActive Publication Date: 2025-11-04THE 54TH RESEARCH INSTITUTE OF CHINA ELECTRONICS TECHNOLOGY GROUP CORPORATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410207002.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-26
Publication Date
2025-11-04
Estimated Expiration
2044-02-26

AI Technical Summary

Technical Problem

Existing deep learning methods struggle to effectively detect image anomalies when there is a lack of abnormal sample data, and existing autoencoder networks have insufficient feature extraction and reconstruction capabilities, resulting in poor detection performance.

Method used

We employ a nested residual autoencoder model, which enhances feature representation and reduces information loss by designing a nested residual encoder-decoder network and a distance metric anomaly scoring model. Furthermore, we train the generator and discriminator through an adversarial mechanism to achieve accurate identification of anomalous images.

Benefits of technology

It improves the accuracy and feature representation ability of image anomaly detection, reduces the risk of overfitting, and enhances the recognition effect of abnormal images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118115448B_ABST
    Figure CN118115448B_ABST
Patent Text Reader

Abstract

The application provides an image anomaly recognition method based on a nested residual auto-encoding model, and belongs to the field of image anomaly detection. The method reconstructs sample data through a nested residual auto-encoding network, a multi-scale nested structure is designed in the generator, the network depth and size can be autonomously adapted, the problem of overstrong or weak network expression capability is solved, the feature expression capability of the auto-encoding network is enhanced, meanwhile, a residual structure and a skip connection are introduced, the overfitting risk is reduced, the transmission of sample detail information is enhanced, and information loss is reduced; meanwhile, a distance measurement anomaly scoring model is designed, the difference between input samples and reconstructed samples is evaluated through various distance functions, and the accuracy of anomaly discrimination is enhanced. The application can realize accurate recognition of abnormal data, and overcome the problem of insufficient semantic expression capability of the feature network of the existing auto-encoder.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of image anomaly detection, and in particular to an image anomaly recognition method based on a nested residual auto-encoding model. BACKGROUND

[0002] Most deep learning methods need a large amount of real fault data and artificial annotation data as support, and are difficult to apply to tasks lacking abnormal sample data. The generation adversarial network has potential application value in anomaly detection. AnoGAN (Anamoly Detection with GAN) first applies the generation adversarial network to the field of anomaly detection. This method only uses normal samples to train the DCGAN (Deep Convolutional GAN), and performs image anomaly detection based on a detection of abnormal image sample and reconstruction image difference distance measurement theory. Due to the training based on normal samples, AnoGAN can realize image anomaly detection without abnormal samples, and lays a foundation for unsupervised anomaly detection based on normal samples.

[0003] An auto-encoder is an unsupervised learning process that reconstructs samples by designing an encoder and a decoder to make the input and output values closer and closer. Based on the theoretical idea of AnoGAN, GANomaly first uses an adversarial mechanism to alternately train the auto-encoder, and simultaneously uses it as a sample reconstruction generator. Then, a classification network hidden layer is added to construct an encoder to measure the semantic feature distance between the test sample and the reconstructed sample. Finally, in the test stage, the abnormal image sample is detected by measuring the difference between the test sample, the reconstructed sample and their deep semantic features. However, this method may lose valuable information in the encoding process, resulting in poor reconstruction of the data. Therefore, Skip-GANomaly is based on the GANomaly method, and introduces a skip connection between the encoding network and the decoding network in the generator to reduce the loss of information in the encoding stage.

[0004] The auto-encoding network structure based on GANomaly and Skip-GANomaly is simple and cannot fully extract the semantic features of the original sample, and thus cannot complete high-level sample reconstruction. In fact, data samples have various structural changes, extremely complex distribution, and not obvious feature expression, and the sample reconstruction task is not optimistic at all. The composition of the encoder-decoder directly affects the effect of the generator to reconstruct the sample, and therefore, it is very important to select a high-performance encoding-decoding network for the image anomaly detection task. SUMMARY

[0005] To overcome the above problems, the application provides an image anomaly recognition method based on a nested residual auto-encoding model.

[0006] The technical scheme adopted by the application is:

[0007] An image anomaly recognition method based on a nested residual auto-encoding model comprises the following steps:

[0008] Step 1, collect normal image samples and abnormal image samples, and construct a training set and a test set; wherein the training set only contains normal image samples, and the test set contains half of normal image samples and half of abnormal image samples;

[0009] Step 2, construct an image anomaly recognition model; the image anomaly recognition model is composed of a generator and a discriminator, wherein the generator is a nested residual encoding-decoding network, and the discriminator is a classifier of a DCGAN model;

[0010] The generator is composed of an encoding part and a decoding part, the encoding part reads in an input sample to generate two different scale deep semantic feature vectors, and the decoding part decodes the two different scale deep semantic feature vectors to obtain a reconstructed sample with the same size as the input sample;

[0011] The discriminator is used to compare and calculate the difference between the input sample and the reconstructed sample, and output an abnormal distance score of the input sample;

[0012] Step 3, train the image anomaly recognition model based on an adversarial mechanism, learn the data distribution of the training set samples, and obtain a trained image anomaly recognition model;

[0013] Step 4, test the trained image anomaly recognition model using the test set, set a threshold for distinguishing normal images and abnormal images according to the score of each input image of the image anomaly recognition model;

[0014] Step 5, input the image to be tested into the trained image anomaly recognition model, and output an abnormal distance score, if the score exceeds the threshold, the image to be tested is determined as an abnormal image, otherwise, it is a normal image.

[0015] Further, in step 1, the image samples are enlarged or reduced so that all the image samples have the same size.

[0016] Further, the decoding part has a residual connection, the inner branch is composed of two residual blocks, the outer branch is composed of four residual blocks, and the inner branch and the outer branch respectively decode semantic feature vectors of two different scales;

[0017] The decoding part uses skip connection for feature fusion, and finally outputs the reconstructed sample by the last layer of the outer branch;

[0018] The generator enables the nested model based on two scales to adapt to the network depth and size autonomously through back propagation.

[0019] Further, the specific manner of step 3 is:

[0020] Step 3.1, input the sample in the training set into the generator of the image anomaly recognition model, and output a reconstructed sample;

[0021] Step 3.2, input the reconstructed sample and the input sample into the discriminator of the image anomaly recognition model, and record the classification loss; fix the parameters of the discriminator, calculate the distance loss between the reconstructed sample, the input sample and their deep semantic feature vectors, and perform gradient back propagation by weighting the sum of the classification loss and the distance loss, and update the parameters of the generator;

[0022] Step 3.3, fix the parameters of the generator, and repeat step 3.2 to update the parameters of the discriminator by using the classification loss;

[0023] Step 3.4, alternately train the generator and the discriminator based on the adversarial mechanism until the loss no longer decreases, save the model parameters, and obtain the trained image anomaly recognition model.

[0024] Further, the loss function L G-Net of the generator is adv

[0025] L G-Net =min(w adv L adv +w con L con +w lat L lat )

[0026] L adv =logD(x real )+log[1-D(x fake )]

[0027] wherein w adv , w con , w lat are weight parameters of each loss, D is the discriminator, f(x real ) and f(x fake ​) are the deep semantic feature vectors of input sample x real and reconstructed sample x fake , L con = S L1 (x real -x fake ) is the SmoothL1 Loss of reconstructed sample x fake and input sample x real , L lat = S L1 (f(x real )-f(x fake )) is the SmoothL1 Loss of deep semantic feature vector f(x real ) and deep semantic feature vector f(x fake );

[0028] The SmoothL1 Loss equation is as follows:

[0029]

[0030] The loss function L D-Net of the discriminator is as follows:

[0031] L D-Net = maxL adv .

[0032] Further, the working mode of the discriminator is as follows:

[0033] Calculate the distance R(x1) of input sample x1 and reconstructed sample x2:

[0034] R(x1) = ||x1-x2||1

[0035] Generate deep semantic feature vectors f(x1) and f(x2) of input sample x1 and reconstructed sample x2, and calculate the distance L(x1) between f(x1) and f(x2):

[0036] L(x1) = ||f(x1)-f(x2)||2

[0037] Proportionally weight and sum the two distances to calculate the preliminary score A(x1) of abnormal distance:

[0038] A(x1) = λR(x1) + (1-λ)L(x1)

[0039] Wherein, λ is a weight parameter balancing the importance of difference score;

[0040] Normalize the preliminary score A(x1) to obtain the final abnormal distance score A'(x1) of input sample x1:

[0041]

[0042] Wherein, min(A) is the minimum value of the preliminary score of all samples in the test set, and max(A) is the maximum value of the preliminary score of all samples in the test set.

[0043] The beneficial effects of the present application are:

[0044] 1. The present application designs an image anomaly recognition model based on a nested residual auto-encoding network, enhances the feature expression ability of the auto-encoding network, and reduces the overfitting risk.

[0045] 2. The present application designs a distance metric anomaly score model, which can reflect the distance between the input sample and the reconstructed sample, and enhance the accuracy of image anomaly discrimination. BRIEF DESCRIPTION OF DRAWINGS

[0046] Figure 1 is a schematic diagram of the principle of the method of the present application;

[0047] Figure 2 is a schematic diagram of the principle of the image anomaly recognition model of the present application;

[0048] Figure 3 is a schematic diagram of the principle of the generator in the image anomaly recognition model of the present application. DETAILED DESCRIPTION

[0049] The present application will be further described below in conjunction with the drawings of the specification.

[0050] An image anomaly recognition method based on a nested residual auto-encoding model, comprising the following steps:

[0051] Step 1, collect normal image samples and abnormal image samples, and construct a training set D train and a test set D test ; wherein the training set only contains normal image samples, and the test set contains half of normal image samples and half of abnormal image samples;

[0052] Step 2, construct an image anomaly recognition model; the image anomaly recognition model is composed of a generator and a discriminator, wherein the generator is a nested residual encoding-decoding network, and the discriminator is a classifier of a DCGAN model;

[0053] The generator is composed of an encoding part and a decoding part, the encoding part reads in the input sample to generate two different scale deep semantic feature vectors, and the decoding part decodes the two different scale deep semantic feature vectors to obtain a reconstructed sample with the same size as the input sample.

[0054] The discriminator is used for comparison calculation of the difference between the input sample and the reconstructed sample, and outputs the abnormal distance score of the input sample;

[0055] Step 3, training the image anomaly recognition model based on the adversarial mechanism, learning the data distribution of the training set samples, learning the data distribution of the normal samples, and obtaining the weight parameter file of the trained image anomaly recognition model;

[0056] Step 4, using the test set to test the trained image anomaly recognition model, inputting the test sample into the trained image anomaly recognition model for sample reconstruction, using the distance measurement anomaly score model to compare the difference between the network reconstructed sample and the original sample, obtaining the score of each test sample, and setting a threshold value for distinguishing normal images and abnormal images according to the score;

[0057] Step 5, inputting the to-be-tested image into the trained image anomaly recognition model, outputting the abnormal distance score, and determining the to-be-tested image as an abnormal image if the score exceeds the threshold value, otherwise as a normal image.

[0058] Wherein, the image anomaly recognition model is composed of a generator and a discriminator, wherein the generator is a nested residual encoding decoding network, and the discriminator uses the classifier of the DCGAN model.

[0059] The generator is composed of an encoding branch and a decoding branch, the encoding part G E obtains the semantic feature vector of the original sample, and the decoding part G D reconstructs the semantic feature vector into an image x real with the same size as the input sample x fake as output. The encoding part G E reads the input sample x real , generates a deep semantic feature map z=(z1, z2), wherein

[0060] z=G E (x real )

[0061] The decoding part G D decodes the deep semantic feature maps z1 and z2 of two different scales. The decoding branch adds a residual connection, the inner branch is composed of three residual blocks, and the outer branch is composed of four residual blocks, which respectively decode the semantic feature maps z1 and z2 of two different scales. The residual structure enhances the feature expression ability of the decoding part and reduces the risk of overfitting. In addition, the decoding branch in the inner part uses skip connection to fuse the features of the outer decoding branch, and finally outputs the reconstructed sample x fake of the decoder by the outer branch last layer.

[0062] x fake =GD (z)

[0063] The generator makes the two-scale-based nested model self-adapt to the network depth and size through back propagation, solving the problem of over-strong or over-weak network expression capability. Meanwhile, the skip connection between the decoders enhances the transmission of sample detail information and reduces information loss.

[0064] The discriminator D is a classification network, which can predict the category of a given input, and distinguish the real normal sample x real from the generated sample x fake . In addition, as a feature extraction network, the discriminator D can obtain the deep semantic feature vectors f(x real ) and f(x fake ) of the input sample x real and x fake , calculate the feature difference distance of the sample, and use it as a component of the anomaly score.

[0065] The following is a more specific example:

[0066] An image anomaly recognition method based on a nested residual auto-encoding model, as shown in Figure 1 , includes the following steps:

[0067] Step 1, store the normal sample and abnormal sample data by class, and then divide them into training set and test set respectively to form an anomaly recognition dataset.

[0068] Among them, the initial dataset is divided into training set D train and test set D test , and is enlarged or reduced according to a unified size, wherein the training set only contains normal samples, and the test set contains half of normal samples and half of abnormal samples.

[0069] Step 2, construct an image anomaly recognition model, use the training set in step 1, train the anomaly recognition model based on the adversarial mechanism, and learn the data distribution of the normal sample to obtain a weight parameter file.

[0070] Among them, step 2 includes the following sub-steps:

[0071] Step 2.1, reconstruct the sample: input the original sample into the generator of the anomaly recognition model, and output the sample with the same size as the original sample as the reconstructed sample.

[0072] Among them, in step 2.1, the anomaly recognition model is composed of a generator and a discriminator, as shown in Figure 2 , the generator is a nested residual encoding and decoding network, as shown in Figure 3 , which is the main part of the model, and the discriminator uses the classifier of the DCGAN model.

[0073] The generator consists of an encoding branch and a decoding branch, the encoding part G E The semantic features of the original sample are obtained, and the decoding part is G D The semantic feature vector is reconstructed into the input sample x real The size of x fake As output. The encoding part G E Read the input sample x real , produce a deep semantic feature vector z = (z1, z2), where

[0074] z = G E (x real )

[0075] The decoding part G D Decodes the deep semantic feature vectors z1 and z2 of two different scales. The decoding branch adds a residual connection, the inner branch consists of two residual blocks, and the outer branch consists of four residual blocks, which respectively decode the semantic feature vectors z1 and z2 of two different scales. The residual structure enhances the feature expression ability of the decoding part and reduces the risk of overfitting. In addition, the decoding branch in the inner part uses skip connection to fuse the features of the outer decoding branch, and finally the reconstructed sample x fake Of the decoder can be represented as

[0076] x fake = G D (z)

[0077] The generator makes the nested model of two scales adapt to the network depth and size by back propagation, solves the problem of overexpression or underexpression of the network. At the same time, the skip connection between the decoders enhances the transmission of sample detail information and reduces the information loss.

[0078] The discriminator D belongs to the classification network, which can predict the category of the given input, and distinguish the real normal sample x real And the generator reconstructed sample x fake In addition, as a feature extraction network, the discriminator D can obtain the deep semantic feature vectors f(x real ) and f(x fake ) of the input sample x real And x fake , calculate the feature difference distance of the sample, and construct the partial anomaly score.

[0079] Step 2.2, Generator parameter update: Perform binary classification training, input the reconstructed sample and the original sample into the discriminator of the anomaly identification model, and record the classification loss. Fix the discriminator parameters, calculate the distance loss between the reconstructed sample, the original sample and its deep semantic feature, and the weighted sum of the classification loss for gradient back propagation to update the generator parameters.

[0080] wherein, in step 2.2, let S L1 be the SmoothL1 Loss equation

[0081]

[0082] The loss function L G-Net of the generator adv , the classification loss function L G-Net of the reconstructed sample adv respectively adv L con con L lat lat )

[0083] L adv = logD(x real ) + log[1-D(x fake )]

[0084] wherein w adv , w con , w lat are weight parameters of each loss, L con = S L1 (x real -x fake ) is the SmoothL1 Loss of the reconstructed sample x fake and the input sample x real , and L lat = S L1 (f(x real )-f(x fake )) is the SmoothL1 Loss of the last layer deep semantic feature vector obtained after the discriminator convolution operation on the reconstructed sample x fake and the input sample x real .

[0085] Step 2.3, Discriminator parameter update: Fix the generator parameters, repeat step 2.2, and update the parameters of the discriminator using the classification loss.

[0086] wherein, in step 2.3, the loss function of the discriminator is L D-Net

[0087] L D-Net ​​= max L adv

[0088] Step 2.4, alternating training: alternately train the generator and discriminator based on the adversarial mechanism until the loss no longer decreases, save the optimal parameter model.

[0089] Step 3, image anomaly identification test using the test set in step 1, input the test sample into the image anomaly identification model trained in step 2 for sample reconstruction, use the distance metric anomaly score model to compare the difference between the network reconstructed sample and the original input sample, and detect whether it is abnormal.

[0090] Wherein, step 3 includes the following sub-steps:

[0091] Step 3.1, the nested residual coding-decoding network model is imported into the training stage optimal parameter model, the generator reads the test sample x1, and generates the reconstructed test sample x2.

[0092] Wherein, in step 3.1,

[0093] x2 = G D (G E (x1))

[0094] Step 3.2, calculate the anomaly distance score of test sample x1 using the distance metric anomaly score model. Calculate the distance between test sample x1 and reconstructed sample x2 and record it, and input them into the discriminator to generate semantic feature vectors f(x1) and f(x2) (the input of the last classification layer of the discriminator), calculate the distance between the vectors and record it. Calculate the anomaly score A(x1) by proportionally weighting and summing the two distances. Calculate the anomaly score set A of all samples in the test set D test , and calculate the anomaly distance score A'(x1) of test sample x1 by normalizing processing.

[0095] Wherein, in step 3.2, R(x1) = ||x1-x2||1 represents the L1 distance between x1 and x2, and L(x1) = ||f(x1)-f(x2)||2 represents the L2 distance between semantic feature vectors f(x1) and f(x2). The anomaly score is defined as

[0096] A(x1) = λR(x1) + (1-λ)L(x1)

[0097] Wherein, λ is a weight parameter balancing the importance of difference score, set λ = 0.9 in this model. Calculate the anomaly score set A = {A test : A(x i ), x test,i ∈D test test ​}, linearly normalizing set A, compressing the anomaly score to [0, 1], and the anomaly distance score A'(x1) of the test sample x1 is

[0098]

[0099] Step 3.3, thresholding, classifying the anomaly distance score, and if the score is greater than the threshold, it is abnormal, otherwise it is normal.

[0100] Step 4, input the image to be tested into the trained image anomaly recognition model, output the normalized anomaly distance score, and if the score exceeds the set threshold, the image to be tested is determined to be an abnormal image, otherwise it is a normal image.

[0101] The following is an actual case:

[0102] The anomaly detection data set CIFAR-10 contains 60,000 images of size 32*32, all of which are divided into 10 classes, namely airplane, car, bird, cat, deer, dog, frog, horse, ship, and truck, with 6,000 images in each class. A certain class in the CIFAR-10 data set is regarded as an abnormal class, and the other 9 classes are regarded as normal samples for experiments. 45,000 image data of the other 9 classes except the abnormal class are used to train the generator and discriminator. The test set is 6,000 images of the abnormal class and 9,000 images of the other normal classes.

[0103] The specific implementation is as follows:

[0104] Step 1, store the normal samples and abnormal sample data by class, and then divide them into training set and test set to form an anomaly recognition data set;

[0105] Step 2, use the training set in step 1 to train the anomaly recognition model based on the adversarial mechanism, learn the data distribution of the normal samples, and obtain the weight parameter file;

[0106] Step 3, use the test set in step 1 to perform anomaly recognition test, input the test sample into the trained anomaly recognition model in step 2 to reconstruct the sample, use the distance metric anomaly score model to compare the difference between the reconstructed sample and the original sample, obtain the anomaly distance score, set the threshold according to the distribution of the anomaly distance score, perform anomaly determination, and obtain the recognition accuracy.

[0107] Comparative Example:

[0108] Comparative Example 1

[0109] AnoGAN method is used as a comparative example, and the same training set and test set as in the embodiment are used for experiments.

[0110] Comparative Example 2

[0111] As a comparative example, the GANomaly method was used to perform experiments using the same training set and test set as the examples.

[0112] Comparative Example 3

[0113] As a comparative example, the Skip-GANomaly method was used to perform experiments using the same training set and test set as the examples.

[0114] The performance indicator used in the test was AUROC, which is the area under the ROC curve composed of FPR and TPR at various threshold settings. The final test results are shown in Table 1.

[0115] Table 1 Comprehensive test results of CIFAR-10 anomaly detection data set

[0116]

[0117] As can be seen from Table 1, in image anomaly detection, the test results of the practical cases of the present application are better than those of Comparative Examples 1, 2 and 3, indicating that the method of the present application improves the detection performance.

[0118] The present application reconstructs sample data through a nested residual auto-encoding network, designs a multi-scale nested structure in the generator, which can adapt to the network depth and size, solves the problem of excessive or insufficient network expression ability, enhances the feature expression ability of the auto-encoding network, and at the same time introduces a residual structure and a skip connection, reduces the risk of overfitting, enhances the transmission of sample detail information, and reduces information loss; at the same time, a distance metric anomaly scoring model is designed, which evaluates the difference between the input sample and the reconstructed sample through various distance functions, and enhances the accuracy of abnormality discrimination.

[0119] In summary, the present application designs an image anomaly recognition model based on a nested residual auto-encoding network and a distance metric anomaly scoring model to solve the problem of insufficient semantic expression ability of the feature network of the auto-encoder. This method enhances the feature expression ability of the auto-encoding network, reduces the risk of overfitting, and effectively reflects the distance between the input sample and the reconstructed sample, improving the accuracy of abnormality judgment, and ultimately achieving accurate recognition of abnormal images.

[0120] The above examples are only used to illustrate the technical solutions of the present application, but not to limit them. Those skilled in the art should understand that the technical solutions described in the above examples can still be improved and optimized, and some technical features can be replaced by equivalents. These improvements or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the examples of the present application.

Claims

1. An image anomaly recognition method based on a nested residual autoencoder model, characterized in that, Includes the following steps: Step 1: Collect normal image samples and abnormal image samples to construct training set and test set; the training set contains only normal image samples, and the test set contains half normal image samples and half abnormal image samples. Step 2: Construct an image anomaly recognition model; the image anomaly recognition model consists of a generator and a discriminator, wherein the generator is a nested residual encoder-decoder network, and the discriminator is a classifier of the DCGAN model; The generator consists of an encoding part and a decoding part. The encoding part reads in the input sample and generates two deep semantic feature vectors at different scales. The decoding part decodes the two deep semantic feature vectors at different scales to obtain a reconstructed sample with the same size as the input sample. The discriminator is used to compare and calculate the differences between the input sample and the reconstructed sample, and output the anomaly distance score of the input sample; Step 3: Train the image anomaly recognition model based on the adversarial mechanism, learn the data distribution of the training set samples, and obtain the trained image anomaly recognition model; Step 4: Test the trained image anomaly recognition model using a test set. Based on the image anomaly recognition model's scores for each input image, set a threshold to distinguish between normal and abnormal images. Step 5: Input the image to be tested into the trained image anomaly recognition model and output the anomaly distance score. If the score exceeds the threshold, the image to be tested is determined to be an anomaly image; otherwise, it is a normal image.

2. The image anomaly recognition method based on a nested residual autoencoder model according to claim 1, characterized in that, In step 1, the image samples are enlarged or reduced so that all image samples have the same size.

3. The image anomaly recognition method based on a nested residual autoencoder model according to claim 1, characterized in that, The decoding part has residual connections, with the inner branch consisting of two residual blocks and the outer branch consisting of four residual blocks. The inner and outer branches decode semantic feature vectors of two different scales, respectively. The decoding part uses skip connections for feature fusion, and finally reconstructs the sample from the output of the last layer of the outer branch; The generator enables nested models based on two scales to autonomously adapt to network depth and size through backpropagation.

4. The image anomaly recognition method based on a nested residual autoencoder model according to claim 3, characterized in that, The specific method for step 3 is as follows: Step 3.1: Input the samples from the training set into the generator of the image anomaly recognition model, and output the reconstructed samples; Step 3.2: Input the reconstructed sample and the input sample into the discriminator of the image anomaly recognition model, and record the classification loss; With the discriminator parameters fixed, calculate the distance loss between the reconstructed sample, the input sample, and their deep semantic feature vectors, and perform gradient backpropagation by weighted summation with the classification loss to update the generator parameters; Step 3.3: Fix the generator parameters and repeat step 3.2 to update the discriminator parameters using the classification loss; Step 3.4: Train the generator and discriminator alternately based on the adversarial mechanism until the loss no longer decreases, save the model parameters, and obtain the trained image anomaly recognition model.

5. The image anomaly recognition method based on a nested residual autoencoder model according to claim 3, characterized in that, The generator's loss function L G-Net The classification loss function L for reconstructing samples adv L respectively G-Net =min(w adv L adv +w con L con +w lat L lat ) L adv =logD(x real )+log[1-D(x fake )] Among them, w adv w con、 w lat Here are the weight parameters for each loss, D is the discriminator, and f(x) is the weight parameter for each loss. real ) and f(x fake ) are the input samples x real and reconstructed sample x fake The deep semantic feature vector, L con =S L1 (x real -x fake ) for reconstructing sample x fake and input sample x real SmoothL1 Loss, L lat =S L1 (f(x real )-f(x fake f(x) is the deep semantic feature vector. real ) and deep semantic feature vector f(x) fake SmoothL1Loss; The SmoothL1 Loss equation is: The loss function L of the discriminator D-Net For L D-Net =maxL adv .

6. The image anomaly recognition method based on a nested residual autoencoder model according to claim 5, characterized in that, The discriminator works as follows: Calculate the distance R(x1) between the input sample x1 and the reconstructed sample x2: R(x1) = ||x1 - x2||1 Generate deep semantic feature vectors f(x1) and f(x2) for input sample x1 and reconstructed sample x2, and calculate the distance L(x1) between f(x1) and f(x2): L(x1)=||f(x1)-f(x2)||2 The two distances are weighted and summed proportionally to calculate the preliminary score A(x1) for the anomaly distance: A(x1)=λR(x1)+(1-λ)L(x1) Wherein, λ is the weighting parameter for balancing the importance of difference scores; Normalize the initial score A(x1) to obtain the final anomaly distance score A′(x1) for the input sample x1: Wherein, min(A) is the minimum initial score of all samples in the test set, and max(A) is the maximum initial score of all samples in the test set.

Citation Information

Patent Citations

  • Abnormal region detection method for adversarial auto-encoder based on introduction of automatic memory mechanism

    CN110992354A

  • Unsupervised learning image anomaly detection method based on auto-encoder

    CN112101426A