Anomaly detection method and device based on neighborhood perception and feature distillation
Through the method based on neighborhood perception and feature distillation, using four-angle convolution and feature reconstruction technology, combined with channel and spatial attention, the difficulty of traditional supervised detection methods in identifying no abnormalities and the accuracy of unsupervised detection methods in feature reconstruction is solved. Unsatisfactory problems achieve high accuracy abnormal detection and positioning.
Patent Information
- Application Number
- CN202411370964.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-09-29
AI Technical Summary
The traditional supervised abnormality detection method has difficulties in identifying no abnormalities, while the existing unsupervised detection method is based on reconstruction technology, resulting in less obvious differences in the characterization of abnormal features, and the reconstruction accuracy of normal features is not ideal, which limits the abnormality detection. accuracy.
Using anomaly detection method based on neighborhood perception and feature distillation, the multi-dimensional features of the input sample are extracted, and the global spatial features are predicted by four-angle convolution is used to perform feature distillation and reconstruction, combining channel attention and spatial attention calculation to enhance abnormal features The characterization difference from normal characteristics and improve robustness through perturbation, and the abnormal detection results are finally obtained.
It effectively improves the accuracy of abnormal detection and positioning, ensures that abnormal features are treated significantly differently in reconstruction, enhances the ability to identify abnormalities in complex feature spaces, and accurately recognizes and determines the exact location of abnormal features.
Smart Images

Figure CN118887413B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of anomaly detection, and specifically relates to an anomaly detection method and device based on neighborhood perception and feature distillation. Background Art
[0002] Anomaly detection is one of the key technologies for identifying and locating abnormal phenomena in various fields, especially in scenarios such as industrial product inspection, medical diagnosis, and video surveillance. Anomaly detection plays an important role in timely discovering potential problems, ensuring product quality, improving diagnosis and treatment efficiency, and maintaining public safety. For the implementation of anomaly detection, there are traditional supervised detection methods and existing unsupervised detection methods. However, due to the scarcity of negative samples and the lack of prior knowledge, traditional supervised detection methods have difficulties in identifying unseen anomalies. The existing unsupervised detection methods are based on reconstruction technology, and the difference in the representation of abnormal features is not obvious, and the reconstruction accuracy of normal features is not ideal, which restricts the accuracy of anomaly detection. Summary of the invention
[0003] The purpose of the present invention is to propose an anomaly detection method and device based on neighborhood perception and feature distillation, which can effectively improve the ability to detect and locate anomalies.
[0004] The present invention is achieved through the following technical solutions:
[0005] The anomaly detection method based on neighborhood perception and feature distillation includes the following steps:
[0006] Step S1: Extract input samples m Features of different dimensions , four-corner convolution is used to predict the global arrangement of each feature to obtain a m global spatial features, where i =1,2,…, m ;
[0007] Step S2: distill each global spatial feature to remove the influence of abnormal features, obtain a compact low-dimensional normal feature tensor, add disturbance to the low-dimensional normal feature tensor and perform feature reconstruction to obtain a reconstructed m Normal features ;
[0008] Step S3, respectively calculate channel attention and spatial attention for the features obtained from the input sample and the reconstructed normal features, and obtain the sample feature tensor and the reconstructed feature tensor that pay attention to both the channel and the space, and then obtain the abnormality of each pixel in the sample feature tensor according to the similarity between the sample feature tensor and the reconstructed feature tensor, and accumulate the abnormal pixels to obtain the abnormality detection result.
[0009] Furthermore, in step S1, according to the formula Extract the input sample m Features of different dimensions ,in, I represents the input sample, Indicates i A feature extractor network, which is a pre-trained WideResNet-50 network. c i 、h i 、w i Respectively represent i The number of channels, height, and width of the tensor extracted by the feature extractor network.
[0010] Furthermore, in step S1, the four-corner convolution is used to predict the global arrangement of each feature to obtain a spatial position information m A global space feature, specifically including the following steps:
[0011] Step S11: According to the four-corner convolution formula Get the predicted global spatial feature map ,in, is the convolution kernel, k’ To define the hyperparameter of the convolution kernel size, the convolution kernel K n The shielded area located at the center of the receptive field d At , the spatial position information of the shielding area M is predicted by the receptive field prediction center of the four corner areas. Features In K n The value of the corresponding position;
[0012] Step S12: connect Reduce to vector , and according to the formula Derive the scaling factor vector ,in, , Represent the weight matrix of the fully connected layer, which is composed of neurons, r The reduction ratio compresses information, ReLu(.) represents the activation function, and Sigmoid(.) represents normalization;
[0013] Step S13: Scaling factor vector Repeat along the spatial dimension to generate Tensors of the same size , and according to the formula Enhanced spatial features , spatial characteristics Compensated The missing global space position information in , where represents element-wise multiplication;
[0014] Step S14: According to the formula Get the spatial location information m Global Space Features ,in, Represents element-wise addition.
[0015] Furthermore, in step S2, obtaining a compact low-dimensional normal feature tensor specifically includes:
[0016] Step S21: According to the formula Project each global spatial feature into the same low-dimensional space and align the dimensions to obtain the fused feature tensor , where SubConv(.) represents the downsampling convolution operation, SubConv m (.) indicates m All quantities are downsampled and convolved. ReMLP means using MLP network for normalization and ReLU activation, where: c', h', w' Respectively represent the number of channels, height and width of the fused feature tensor;
[0017] Step S22: Filter the fused feature tensor F using a trainable cascade residual unit L Abnormal features in , get a compact low-dimensional normal feature tensor F N = R u (F L ), where Ru(.) represents the cascaded residual unit. During the training phase, only normal data is used to train the cascaded residual unit.
[0018] Furthermore, in step S2, the reconstructed m Normal features Specifically include:
[0019] Step S23: Add the perturbation D to the low-dimensional normal feature tensor F N In, get ,in, is a Gaussian distribution, is the mean of the Gaussian distribution, is the Gaussian distribution variance, is the noise parameter set, f N Yes F N The characteristic vector of c is the vector f NThe number of channels;
[0020] Step S24: According to the formula Perform feature reconstruction to obtain reconstructed normal features , where R i (.) indicates the i The feature reconstruction network adopts a symmetrical but opposite structural design, which consists of symmetrical residual decoding blocks constructed by deconvolution layers.
[0021] Furthermore, the step S3 specifically includes:
[0022] Step S31: for the features obtained from the input sample , according to the formula Calculate channel attention and spatial attention to obtain sample feature tensors that are noticed in both channels and spaces , for the reconstructed normal features , according to the formula Calculate the channel attention and spatial attention to obtain the reconstructed feature tensor that pays attention to both the channel and the space ,in, and Indicates that it corresponds to and The spatial attention weights, and Respectively represent the corresponding and The channel attention weight of
[0023] Step S32: According to the formula Get the first i Sample feature tensor The anomaly of each pixel in , where 1≤ h ≤ h i , 1≤ w ≤ w i ;
[0024] Step S33: In order to locate the anomaly, the score map is formulated as m Pixel-by-pixel accumulation of layer anomalies to obtain a scalar loss function , learn with this scalar loss function, and get the optimal The anomaly graph represented;
[0025] Step S34: According to the formula Get the final anomaly score map A p ,in, Represents an upsampling operation.
[0026] Furthermore, the input sample is a data set MVTec.
[0027] The present invention is also achieved through the following technical solutions:
[0028] An anomaly detection device based on adversarial neighborhood perception and feature distillation includes a processor and a memory, wherein program instructions are stored in the memory, and the processor calls the program instructions in the memory to implement the following modules:
[0029] Multi-scale neighborhood perception module: used to extract the input samples m Features of different dimensions , four-corner convolution is used to predict the global arrangement of each feature to obtain a m global spatial features, where i =1,2,…, m ;
[0030] Robust distillation recovery module: used to distill each global spatial feature to remove the influence of abnormal features, obtain a compact low-dimensional normal feature tensor, add disturbances to the low-dimensional normal feature tensor and perform feature reconstruction to obtain a reconstructed m Normal features ;
[0031] Collaborative attention adversarial detection module: used to calculate channel attention and spatial attention for the features obtained from the input samples and the reconstructed normal features respectively, to obtain the sample feature tensor and the reconstructed feature tensor noticed in both channels and space, and then obtain the abnormality of each pixel in the sample feature tensor according to the similarity between the sample feature tensor and the reconstructed feature tensor, and accumulate the abnormal pixels to obtain the abnormality detection result.
[0032] The present invention has the following beneficial effects:
[0033] The present invention first extracts the multi-dimensional features of the sample, and uses the four-corner convolution to obtain the global spatial features containing the spatial position information, so as to improve the accuracy of the reconstruction of the normal features. Then, the global spatial features are distilled to remove the influence of the abnormal features, and a compact low-dimensional normal feature tensor is obtained. Perturbations are added to the low-dimensional normal feature tensor and features are reconstructed, so as to suppress the influence of the abnormal features in a targeted manner during the reconstruction process. At the same time, the representation difference between the abnormal features and the normal features is enhanced during the distillation process, so as to ensure that the abnormal features are significantly treated differently in the reconstruction, and the robustness is increased by adding perturbations. Finally, the channel attention and spatial attention are calculated for the features obtained from the input sample and the reconstructed normal features, respectively, to obtain the sample feature tensor and the reconstructed feature tensor noticed in both the channel and the space, and then the abnormal situation of each pixel in the sample feature tensor is obtained according to the similarity between the sample feature tensor and the reconstructed feature tensor, and the abnormal pixels are accumulated to obtain the abnormal detection result, so as to achieve focusing on the subspace that may contain the abnormality in the complex feature space, accurately identify the abnormal features and determine their exact positions, thereby effectively improving the detection and positioning capabilities of the abnormality. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The present invention is further described in detail below with reference to the accompanying drawings.
[0035] Figure 1 Flow chart of the method of the present invention.
[0036] Figure 2 This is a four-corner convolution block diagram of the present invention.
[0037] Figure 3 It is a framework diagram of the device of the present invention. DETAILED DESCRIPTION
[0038] like Figure 1 As shown in the figure, the anomaly detection method based on neighborhood perception and feature distillation includes the following steps:
[0039] Step S1: Extract input samples m Features of different dimensions , four-corner convolution is used to predict the global arrangement of each feature to obtain a m global spatial features, where i =1,2,…, m , m =3;
[0040] Specifically, according to the formula Extract the input sample m Features of different dimensions ,in, I represents the input sample, Indicatesi A feature extractor network, which is a pre-trained WideResNet-50-2 network. c i 、h i 、w i Respectively represent i The number of channels, height, and width of the tensor extracted by the feature extractor network.
[0041] In this embodiment, the input sample is the MVTec dataset, which is a collection of real-world industrial images with 5 textures and 10 object classes for industrial anomaly detection. The training set consists of 3629 normal images. The test set consists of 1725 normal and abnormal sample images, and each category contains multiple anomalies for testing;
[0042] Four-corner convolution is used to predict the global arrangement of each feature to obtain a m A global space feature, specifically including the following steps:
[0043] Step S11: According to the four-corner convolution formula Get the predicted global spatial feature map , in order to effectively predict the global arrangement and distribution of local features in the entire input data through the local four-corner area information, such as Figure 2 As shown, is the convolution kernel. When performing the convolution operation, only the Input value at the location , other information is ignored, and the convolution operation results between each convolution kernel and its corresponding input are accumulated into a value, which predicts the position information of the central masked area M, where k’ To define the hyperparameter of the convolution kernel size, the convolution kernel K n The shielded area located at the center of the receptive field d At , the spatial position information of the shielding area M is predicted by the receptive field prediction center of the four corner areas. Features In K n The value of the corresponding position;
[0044] In addition, the input value at the corresponding position Zero padding is performed around the pixels and the stride of the convolution kernel is set to 1 to ensure that every position in the input contributes to the mask information;
[0045] Step S12: connect Reduce to vector , and according to the formula Derive the scaling factor vector ,in, , Represent the weight matrix of the fully connected layer, which is composed of neurons, r The reduction ratio compresses information, ReLu(.) represents the activation function, and Sigmoid(.) represents normalization;
[0046] Step S13: Scaling factor vector Repeat along the spatial dimension to generate Tensors of the same size , and according to the formula Enhanced spatial features , spatial characteristics Compensated The missing global space position information in , where represents element-wise multiplication;
[0047] Step S14: According to the formula Get the spatial location information m Global Space Features ,in, Represents element-wise addition.
[0048] Step S2: distill each global spatial feature to remove the influence of abnormal features, obtain a compact low-dimensional normal feature tensor, add disturbance to the low-dimensional normal feature tensor and perform feature reconstruction to obtain a reconstructed m Normal features ;
[0049] Specifically, considering the adverse effects of abnormal features, before using the global spatial feature representation obtained in step S1 to perform feature reconstruction, it is necessary to use a robust distillation restoration module to eliminate the abnormal features therein, and adopt a noise gain mechanism to improve robustness;
[0050] The specific steps include:
[0051] Step S21: According to the formula Project each global spatial feature into the same low-dimensional space and align the dimensions to obtain the fused feature tensor , where SubConv(.) represents the downsampling convolution operation, SubConv m (.) indicates m Each quantity is subjected to downsampling convolution operation with a step size of 2. ReMLP means using MLP network for normalization and ReLU activation, where c', h', w' Respectively represent the number of channels, height and width of the fused feature tensor;
[0052] Step S22: Filter the fused feature tensor F using a trainable cascade residual unit L Abnormal features in , get a compact low-dimensional normal feature tensor F N = R u (F L ), the low-dimensional normal feature tensor is used for subsequent reconstruction, where Ru(.) represents the cascade residual unit. In the training phase, only normal training data is used to train the cascade residual unit, and the focus is on extracting the normal feature tensor. In the test phase, due to the atypicality and inconsistency of abnormal features with normal training data, they are regarded as interference with the normal pattern in the feature extraction process. Therefore, they are attenuated or eliminated in the feature extraction process. The role of residual extraction is to act as an information bottleneck, effectively counteracting any influence of abnormal interference on the recovery of normal features.
[0053] Step S23: Add the perturbation D to the low-dimensional normal feature tensor F N In, get , whose dimension is the same as F N The same, among which, is a Gaussian distribution, is the mean of the Gaussian distribution, is the Gaussian distribution variance, is the noise parameter set, f N For and F N The characteristic vector of c is the vector f N The number of channels;
[0054] Step S24: According to the formula Perform feature reconstruction to obtain reconstructed normal features , where R i (.) indicates the i The feature reconstruction network adopts a symmetrical but opposite structural design, which consists of symmetrical residual decoding blocks constructed by deconvolution layers.
[0055] Step S3, respectively, calculating channel attention and spatial attention for the features obtained from the input sample and the reconstructed normal features, obtaining a sample feature tensor and a reconstructed feature tensor noticed in both the channel and the space, and then obtaining the abnormality of each pixel in the sample feature tensor according to the similarity between the sample feature tensor and the reconstructed feature tensor, and accumulating the abnormal pixels to obtain an abnormality detection result;
[0056] Specifically include:
[0057] Step S31: During the forward propagation process, channel attention and spatial attention are calculated separately for the features obtained from the input sample. , according to the formula Calculate channel attention and spatial attention to obtain sample feature tensors that are noticed in both channels and spaces , for the reconstructed normal features , according to the formula Calculate the channel attention and spatial attention to obtain the reconstructed feature tensor that pays attention to both the channel and the space ,in, and Indicates that it corresponds to and The spatial attention weights, and Respectively represent the corresponding and The channel attention weight of
[0058] Among them, the features obtained for the input samples are and reconstructed normal features , using adaptive average pooling and generating channel attention weights through ReLU activation and , and use the sigmoid activation function to spatially weight these weights. The spatial attention component generates features obtained by the input sample through the convolutional layer. and reconstructed normal features The corresponding spatial attention weight and ;
[0059] Step S32: quantify the similarity between two features by performing a dot product operation, that is, according to the formula Get the first i Sample feature tensor The anomaly of each pixel in , The maximum value of represents the highest outlier value at that location, where 1≤ h ≤ h i , 1≤ w ≤ w i ;
[0060] Step S33: In order to locate the anomaly, the score map is formulated as m Pixel-by-pixel accumulation of layer anomalies to obtain a scalar loss function , learn with this scalar loss function, and get the optimal The anomaly graph represented;
[0061] Step S34: According to the formula Get the final anomaly score map A p ,in, Represents an upsampling operation.
[0062] The model is trained by setting reasonable parameters, and the final result uses the area under the receiver operating characteristic curve (AUROC) and each region overlap (AUPRO), the most widely used evaluation indicators in anomaly detection, as evaluation indicators.
[0063] Correspondingly, the unsupervised anomaly detection device based on adversarial neighborhood perception and feature distillation includes a processor and a memory, wherein the memory stores program instructions, such as Figure 3 As shown, the processor calls the program instructions in the memory to implement the following modules:
[0064] Multi-scale neighborhood perception module: used to extract the input samples m Features of different dimensions , four-corner convolution is used to predict the global arrangement of each feature to obtain a m A global spatial feature;
[0065] More specifically, the multi-scale neighborhood perception module is mainly composed of a feature extractor, a prediction convolution, a convolution layer, an activation function, and a normalization unit. In this module, the feature extractor extracts a multi-scale and comprehensive representation of the input sample; Figure 2 As shown in the figure, the prediction convolution aims to effectively predict the global arrangement distribution of local features in the entire input data through the local four-corner area information; the convolution layer deeply fuses the predicted multi-scale features; the activation function introduces nonlinear transformation to give the model the ability to express complex nonlinear relationships; the normalization unit stabilizes the network training process and accelerates the convergence speed by standardizing the input, which also helps to alleviate overfitting and improve the generalization performance of the model.
[0066] Robust distillation recovery module: used to distill each global spatial feature to remove the influence of abnormal features, obtain a compact low-dimensional normal feature tensor, add disturbances to the low-dimensional normal feature tensor and perform feature reconstruction to obtain a reconstructed m Normal features ;
[0067] Collaborative attention adversarial detection module: used to calculate channel attention and spatial attention for the features obtained from the input samples and the reconstructed normal features respectively, to obtain the sample feature tensor and the reconstructed feature tensor noticed in both channels and space, and then obtain the abnormality of each pixel in the sample feature tensor according to the similarity between the sample feature tensor and the reconstructed feature tensor, and accumulate the abnormal pixels to obtain the abnormality detection result.
[0068] The above description is only a preferred embodiment of the present invention, and therefore cannot be used to limit the scope of implementation of the present invention. That is, equivalent changes and modifications made according to the scope of the patent application of the present invention and the contents of the specification should still fall within the scope covered by the patent of the present invention.
Claims
1. Anomaly detection method based on neighborhood perception and feature distillation, characterized by: The steps include: Step S1: Extract features of m different dimensions of the input sample Four-corner convolution is used to predict the global arrangement of each feature to obtain m global spatial features containing spatial position information, where the input sample is a real-world industrial image, i = 1, 2, ..., m; Step S2: distill each global spatial feature to remove the influence of abnormal features, obtain a compact low-dimensional normal feature tensor, add disturbance to the low-dimensional normal feature tensor and perform feature reconstruction to obtain m reconstructed normal features. Step S3, respectively, calculating channel attention and spatial attention for the features obtained from the input sample and the reconstructed normal features, obtaining a sample feature tensor and a reconstructed feature tensor noticed in both the channel and the space, and then obtaining the abnormality of each pixel in the sample feature tensor according to the similarity between the sample feature tensor and the reconstructed feature tensor, and accumulating the abnormal pixels to obtain an abnormality detection result; In step S2, m normal features are reconstructed Specifically include: Step S23: Add the perturbation D to the low-dimensional normal feature tensor F N In, get in, is Gaussian distribution, μ is the mean of Gaussian distribution, γ is the variance of Gaussian distribution, α is the set noise parameter, f N Yes F N The eigenvector of , c is the eigenvector f N The number of channels; Step S24: According to the formula Perform feature reconstruction to obtain reconstructed normal features in, R i (·) represents the i-th feature reconstruction network, which adopts a symmetrical but opposite structural design and consists of symmetrical residual decoding blocks constructed by deconvolution layers; The step S3 specifically includes: Step S31: for features obtained from input samples According to the formula Calculate channel attention and spatial attention to obtain sample feature tensors that are noticed in both channels and spaces For the reconstructed normal features According to the formula Calculate channel attention and spatial attention to obtain the reconstructed feature tensor that pays attention to both channels and space in, and Respectively represent the corresponding and The spatial attention weights, and Respectively represent the corresponding and The channel attention weight of Step S32: According to the formula Get the i-th sample feature tensor The abnormality of each pixel in A i (h, w), where 1≤h≤h i , 1≤w≤w i ; Step S33: Convert the score map formula into the pixel-by-pixel accumulation of m-layer abnormalities to obtain a scalar loss function Using this scalar loss function to learn, we get the optimal A i The anomaly graph represented; Step S34: According to the formula Get the final anomaly score map A p , where Φ(·) represents the upsampling operation.
2. The anomaly detection method based on neighborhood perception and feature distillation according to claim 1, characterized in that: In step S1, according to the formula Extract features of m different dimensions of the input sample in, I represents the input sample, represents the i-th feature extractor network, which is a pre-trained WideResNet-50 network, c i 、h i 、w i They represent the number of channels, height, and width of the tensor extracted by the i-th feature extractor network, respectively.
3. The anomaly detection method based on neighborhood perception and feature distillation according to claim 2 is characterized in that: In step S1, the global arrangement of each feature is predicted by using four-corner convolution to obtain m global spatial features containing spatial position information, which specifically includes the following steps: Step S11: According to the four-corner convolution formula Get the predicted global spatial feature map in, is the convolution kernel, k' is the hyperparameter that defines the size of the convolution kernel, and the convolution kernel K n Located at the shielded area d away from the center of the receptive field, the spatial position information of the center shielded area M is predicted through the receptive fields of the four corner areas. Features In K n The value of the corresponding position; Step S12: connect Reduce to vector And according to the formula Derive the scaling factor vector in, Represent the weight matrix of the fully connected layer, which is composed of It is composed of neurons, compressing information with a reduction ratio of r, ReLu(·) represents the activation function, and Sigmoid(·) represents normalization; Step S13: Scaling factor vector s i Repeat along the spatial dimension to generate Tensor S of the same size i , and according to the formula Enhanced spatial features Spatial characteristics Compensated The missing global space position information in , where ∝ represents element-wise multiplication; Step S14: According to the formula Get m global spatial features containing spatial position information in, Represents element-wise addition.
4. The anomaly detection method based on neighborhood perception and feature distillation according to claim 3 is characterized in that: In step S2, obtaining a compact low-dimensional normal feature tensor specifically includes: Step S21: According to the formula Project each global spatial feature into the same low-dimensional space and align the dimensions to obtain the fused feature tensor Among them, SubConv m (·) indicates a downsampling convolution operation, SubConv m (·) indicates that the m global spatial features are all downsampled and convolved, ReMLP indicates that the MLP network is used for normalization and the ReLU activation function is used, where c', h', and w' represent the number of channels, height, and width of the fused feature tensor, respectively; Step S22: Filter the fused feature tensor F using a trainable cascade residual unit L Abnormal features in , get a compact low-dimensional normal feature tensor F N =R u (F L ), where Ru(·) represents the cascaded residual unit. During the training phase, only normal data is used to train the cascaded residual unit.
5. An anomaly detection device based on neighborhood perception and feature distillation, characterized in that: It includes a processor and a memory, the memory stores program instructions, and the processor calls the program instructions in the memory to implement the following modules: Multi-scale neighborhood perception module: used to extract features of m different dimensions of input samples Four-corner convolution is used to predict the global arrangement of each feature to obtain m global spatial features containing spatial position information, where the input sample is a real-world industrial image, i = 1, 2, ..., m; Robust distillation recovery module: used to distill each global spatial feature to remove the influence of abnormal features, obtain a compact low-dimensional normal feature tensor, add disturbances to the low-dimensional normal feature tensor and perform feature reconstruction to obtain m reconstructed normal features Collaborative attention adversarial detection module: used to calculate channel attention and spatial attention for the features obtained from the input sample and the reconstructed normal features, respectively, to obtain the sample feature tensor and the reconstructed feature tensor noticed in both the channel and the space, and then obtain the abnormality of each pixel in the sample feature tensor according to the similarity between the sample feature tensor and the reconstructed feature tensor, and accumulate the abnormal pixels to obtain the abnormality detection result; Among them, the reconstructed m normal features are obtained Specifically include: Add the perturbation D to the low-dimensional normal feature tensor F N In, get in, is Gaussian distribution, μ is the mean of Gaussian distribution, γ is the variance of Gaussian distribution, α is the set noise parameter, f N Yes F N The eigenvector of , c is the eigenvector f N The number of channels; According to the formula Perform feature reconstruction to obtain reconstructed normal features in, R i (·) represents the i-th feature reconstruction network, which adopts a symmetrical but opposite structural design and consists of symmetrical residual decoding blocks constructed by deconvolution layers; The implementation of the collaborative attention adversarial detection module specifically includes: For the features obtained from the input samples According to the formula Calculate channel attention and spatial attention to obtain sample feature tensors that are noticed in both channels and spaces For the reconstructed normal features According to the formula Calculate channel attention and spatial attention to obtain the reconstructed feature tensor that pays attention to both channels and space in, and Respectively represent the corresponding and The spatial attention weights, and Respectively represent the corresponding and The channel attention weight of According to the formula Get the i-th sample feature tensor The abnormality of each pixel in A i (h, w), where 1≤h≤h i , 1≤w≤w i ; The score map formula is converted into a pixel-by-pixel accumulation of anomalies in the m layers, and the scalar loss function is obtained. Using this scalar loss function to learn, we get the optimal A i The anomaly graph represented; According to the formula Get the final anomaly score map A p , where Φ(·) represents the upsampling operation.
