An Unsupervised Industrial Anomaly Detection Method and System Based on Knowledge Distillation

By constructing an unsupervised industrial anomaly detection system based on knowledge distillation, and utilizing an anomaly synthesis network and a self-supervised reconstruction module to capture the global context structure of local features, the problem of lack of anomaly samples in unsupervised learning is solved, and efficient detection and localization of surface defects in industrial products is achieved.

CN119991555BActive Publication Date: 2025-11-14DONGHUA UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411883573.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-11-14
Estimated Expiration
2044-12-19

AI Technical Summary

Technical Problem

Existing unsupervised industrial anomaly detection methods suffer from a lack of anomalous samples, leading to performance limitations. Furthermore, traditional convolutional neural networks cannot effectively capture the global contextual structure of local features, resulting in poor performance when detecting anomalies in complex global structures.

Method used

A knowledge distillation-based approach is adopted to generate fake anomalous images by constructing an anomaly synthesis network, a teacher feature extraction network, a variable denoising student network, and a pixel-level anomaly segmentation network. The self-supervised reconstruction module captures the global context structure of local features, and combined with multi-scale feature extraction and anomaly region denoising, accurate anomaly detection is achieved.

Benefits of technology

It significantly improves the accuracy and robustness of industrial image anomaly detection, enabling more reliable detection and localization of product surface defects, and enhancing detection sensitivity and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119991555B_ABST
    Figure CN119991555B_ABST
Patent Text Reader

Abstract

This invention provides an unsupervised industrial anomaly detection method and system based on knowledge distillation. The modeling method includes: acquiring surface images of industrial products; preprocessing the surface images to obtain training and testing sets; constructing an anomaly synthesis network, a teacher feature extraction network, a variable denoising student network, and a pixel-level anomaly segmentation network; sequentially integrating the anomaly synthesis network, teacher feature extraction network, variable denoising student network, and pixel-level anomaly segmentation network to form an anomaly detection model; training the anomaly detection model using the training set; validating the trained anomaly detection model using the testing set; and outputting the anomaly detection target model after verification. This invention improves the sensitivity and accuracy of industrial image anomaly detection, achieving more reliable detection, identification, and localization of product surface defects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of visual inspection technology, and relates to neural network models, especially model construction. Specifically, it is an unsupervised industrial anomaly detection method and system based on knowledge distillation. Background Technology

[0002] Unsupervised anomaly detection is an important task in computer vision, involving the identification and localization of anomalous samples in data. This technology has wide applications in fields such as industrial inspection and medical diagnosis. However, due to the scarcity and diversity of anomalous events, obtaining sufficient anomalous samples for supervised training is extremely challenging. Therefore, most current methods focus on unsupervised learning, using only normal samples for training.

[0003] Existing industrial anomaly detection methods typically employ knowledge distillation techniques. One pre-trained convolutional neural network serves as the teacher network, while a student network with the same structure but randomly initialized is optimized during training to generate feature representations similar to the teacher network. Since the student network is trained only on normal data, it produces significantly different feature representations when faced with anomalous data, thus achieving anomaly detection. However, this method has some limitations. First, due to the lack of anomalous sample constraints, the student network may overgeneralize. Second, because traditional convolutional neural networks cannot recognize the global contextual structure of local features, the model's detection performance may be limited when detecting anomalies with complex global structures.

[0004] In summary, how to reduce performance limitations caused by the lack of abnormal samples in industrial defect detection, and how to effectively capture and fully utilize the global structure of local features to improve detection accuracy, are technical problems that existing methods need to solve. Summary of the Invention

[0005] The purpose of this invention is to provide an unsupervised industrial anomaly detection method and system based on knowledge distillation, which solves the problem of low efficiency in the detection of surface anomalies in industrial products in the prior art.

[0006] In a first aspect, the present invention provides an unsupervised industrial anomaly detection method based on knowledge distillation. The method includes: acquiring surface images of industrial products; preprocessing the surface images to obtain training and testing sets; constructing an anomaly synthesis network, a teacher feature extraction network, a variable denoising student network, and a pixel-level anomaly segmentation network; sequentially integrating the anomaly synthesis network, the teacher feature extraction network, the variable denoising student network, and the pixel-level anomaly segmentation network to form an anomaly detection model; training the anomaly detection model using the training set; validating the trained anomaly detection model using the testing set; and outputting an anomaly detection target model after the validation meets the requirements. The anomaly synthesis network is used to synthesize forged anomaly images; the teacher feature extraction network is used to extract multi-scale features of the image and provide feature guidance; the variable denoising student network is used to denoise the abnormal regions of the image; and the pixel-level anomaly segmentation network is used to classify and locate anomalies in the image.

[0007] In one implementation of the first aspect, the preprocessing of the industrial product surface image to obtain a training set and a test set includes: classifying the industrial product surface image according to image category to obtain multiple categories of images; performing data augmentation processing on the industrial product surface image according to different categories to obtain augmented images; selecting images without anomalies in the augmented images as the training set, and selecting the augmented images with anomalies and the corresponding anomaly mask images as the test set.

[0008] In one implementation of the first aspect, the anomaly synthesis network generates an anomaly mask by generating random two-dimensional Perlin noise and binarizing it, and then mixes an anomaly-free image with an image from an external data source at random opacity to generate a simulated anomaly image.

[0009] In one implementation of the first aspect, the teacher feature extraction network includes a ResNet18 convolutional neural network pre-trained on a large natural image dataset, wherein the ResNet18 convolutional neural network has fixed weights and the final convolutional modules have been removed.

[0010] In one implementation of the first aspect, the variable denoising student network includes a denoising module and a self-supervised reconstruction module. The denoising module is used to denoise the input image in the feature dimension to obtain a preliminary denoised feature map. The self-supervised reconstruction module is used to further reconstruct the preliminary denoised feature map and generate discriminative features for features with abnormal contextual structure information.

[0011] In one implementation of the first aspect, the denoising module includes an encoder and a decoder. The encoder employs a randomly initialized ResNet18 convolutional neural network, and the decoder implements an inverse structure through bilinear upsampling. Both the encoder and the decoder include four residual units. The self-supervised reconstruction module includes a variable mask convolution and a channel attention module. The channel attention module employs a masking operation at the center of the convolution and utilizes contextual information to predict or reconstruct the masked information, thereby forcing the model to learn the global contextual information of normal local features.

[0012] In one implementation of the first aspect, the pixel-level anomaly segmentation network includes two residual blocks and a hollow spatial pyramid pooling module, wherein the hollow spatial pyramid pooling module is used to adaptively focus on important feature channels and generate anomaly segmentation maps for anomaly detection.

[0013] In one implementation of the first aspect, training the anomaly detection model using the training set includes: keeping the weights in the anomaly detection model fixed; synthesizing a fake anomaly image through the anomaly synthesis network and inputting it into the variable denoising student network; inputting normal images from the training set into the teacher feature extraction network to calculate a first loss function; keeping the variable denoising student network fixed; synthesizing a fake anomaly image through the anomaly synthesis network and inputting it into both the variable denoising student network and the teacher feature extraction network to train the pixel-level anomaly segmentation network by comparing the feature map differences between the variable denoising student network and the teacher feature extraction network to identify anomaly regions; calculating a focal loss and an L1 loss based on the pixel-level anomaly segmentation network, and calculating a second loss function based on the focal loss and the L1 loss.

[0014] Secondly, the present invention also provides an unsupervised industrial anomaly detection method based on knowledge distillation, which uses the anomaly detection target model established by the above-mentioned unsupervised industrial anomaly detection method based on knowledge distillation to detect surface defects in industrial products.

[0015] Thirdly, this invention also discloses an unsupervised industrial anomaly detection system based on knowledge distillation. The method includes: a preprocessing unit for acquiring surface images of industrial products and preprocessing the surface images to obtain training and testing sets respectively; an integration unit for constructing an anomaly synthesis network, a teacher feature extraction network, a variable denoising student network, and a pixel-level anomaly segmentation network, and sequentially integrating the anomaly synthesis network, the teacher feature extraction network, the variable denoising student network, and the pixel-level anomaly segmentation network to form an anomaly detection model; a training unit for training the anomaly detection model using the training set; and a verification unit for verifying the trained anomaly detection model using the testing set, and outputting an anomaly detection target model after verification meets the requirements; wherein, the anomaly synthesis network is used to synthesize forged anomaly images, the teacher feature extraction network is used to extract multi-scale features of the image and perform feature guidance, the variable denoising student network is used to denoise the abnormal regions of the image, and the pixel-level anomaly segmentation network is used to classify and locate anomalies in the image.

[0016] As described above, the unsupervised industrial anomaly detection method and system based on knowledge distillation of the present invention has the following beneficial effects:

[0017] Compared with existing technologies, this invention significantly improves the accuracy and robustness of industrial image anomaly detection and localization by introducing unsupervised knowledge distillation technology. By utilizing Berlin noise and external datasets to generate simulated anomaly images, the invention increases the amount of anomaly sample data required for training. The teacher feature extraction network extracts the natural feature representation of the input image, while the student network's denoising module generates anomaly-free feature representations. The self-supervised reconstruction module can capture the global contextual structure of local features and generate discriminative features when structural anomalies are detected. Finally, anomaly detection and localization are performed through a pixel-level anomaly segmentation network to obtain more accurate anomaly scores, thereby significantly improving the sensitivity and accuracy of industrial image anomaly detection and achieving more reliable detection, identification, and localization of product surface defects. Attached Figure Description

[0018] Figure 1 The flowchart shown is a process for an unsupervised industrial anomaly detection method based on knowledge distillation, as described in an embodiment of the present invention.

[0019] Figure 2 The diagram shown is a model diagram of the anomaly detection model described in an embodiment of the present invention.

[0020] Figure 3 The diagram shown is a structural block diagram of the self-supervised reconstruction module according to an embodiment of the present invention.

[0021] Figure 4The diagram shown is a structural block diagram of the unsupervised industrial anomaly detection system based on knowledge distillation as described in an embodiment of the present invention. Detailed Implementation

[0022] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0023] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. The illustrations only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0024] See Figures 1 to 4 This invention significantly improves the accuracy and robustness of industrial image anomaly detection and localization by introducing unsupervised knowledge distillation technology. It utilizes Berlin noise and external datasets to generate simulated anomaly images, increasing the amount of anomaly sample data required for training. The teacher feature extraction network extracts natural feature representations of the input image, while the student network's denoising module generates anomaly-free feature representations. The self-supervised reconstruction module captures the global contextual structure of local features and generates discriminative features when structural anomalies are detected. Finally, anomaly detection and localization are performed through a pixel-level anomaly segmentation network, obtaining more accurate anomaly scores. This significantly improves the sensitivity and accuracy of industrial image anomaly detection, enabling more reliable detection, identification, and localization of product surface defects.

[0025] The technical solutions of the present invention will now be described in detail with reference to the accompanying drawings.

[0026] like Figure 1 As shown, in one embodiment, the present invention provides an unsupervised industrial anomaly detection method based on knowledge distillation, the method comprising the following steps:

[0027] S100. Obtain an image of the surface of an industrial product, and preprocess the image to obtain a training set and a test set respectively.

[0028] In one embodiment, the preprocessing of the industrial product surface image to obtain a training set and a test set includes:

[0029] The images of the industrial product surface are classified according to image category to obtain images of multiple categories;

[0030] The surface images of the industrial products are subjected to data augmentation processing according to different categories to obtain enhanced images;

[0031] Images without anomalies in the enhanced images are selected as the training set, and enhanced images with anomalies and their corresponding anomaly mask images are selected as the test set.

[0032] In this embodiment, in order to train the model later, after obtaining the original industrial product surface image, the industrial product surface image is classified according to the image category. This makes it easier to perform enhancement processing on the obtained industrial product surface image according to different categories to obtain enhanced images of different categories. Among the enhanced images of different categories, images without anomalies are selected as the training set, and images with anomalies are selected as the test set, which facilitates the subsequent training of the model.

[0033] Specifically, to better simulate changes in objects in real-world scenarios, the images are first categorized according to industrial product types, into texture images and object images. Texture images are then rotated at discrete angles for data augmentation, such as 0 degrees, 90 degrees, 180 degrees, and 270 degrees. This approach increases sample diversity, and the rotated images retain the same texture information as the originals. However, for object images, excessive rotation angles may distort the structure and logic of the objects or obscure key information. Therefore, a smaller random angle range, such as (-5 degrees, 5 degrees), is set for rotation to obtain more diverse data-augmented images. Next, the pixel size of all images is adjusted to a preset size, such as 224×224. Normal images without anomalies are selected as the training set, while abnormal images with anomalies are selected as the test set. This facilitates subsequent training of the model using the training set and testing of the trained model using the test set.

[0034] S200. Construct an anomaly synthesis network, a teacher feature extraction network, a variable denoising student network, and a pixel-level anomaly segmentation network. Integrate these networks sequentially to form an anomaly detection model. Specifically, the anomaly synthesis network is used to synthesize forged anomalous images; the teacher feature extraction network is used to extract multi-scale features from the image and provide feature guidance; the variable denoising student network is used to denoise anomalous regions in the image; and the pixel-level anomaly segmentation network is used to classify and locate anomalies in the image.

[0035] By constructing an anomaly detection model, it is convenient to train and test the anomaly detection model using training and testing sets.

[0036] like Figure 2 As shown, in one embodiment, the anomaly synthesis network generates random two-dimensional Perlin noise and binarizes it to create an anomaly mask, and then mixes the anomaly-free image with an external data source image at random opacity to generate a simulated anomaly image.

[0037] Specifically, firstly, two-dimensional Perlin noise is randomly generated, and then it is binarized with a preset threshold to create an anomaly mask M. a Then, by using an image from an external data source A and blending the anomalous mask region with the non-anomaly image I using a randomly selected opacity factor β (between 0.15 and 1), the anomalous image I can be generated. a The specific calculation process is as follows:

[0038] I a = (1-M) a )⊙I+(1-β)(M a ⊙I)+β(M a ⊙A)

[0039] Here, ⊙ represents the XOR operation.

[0040] Sufficient abnormal samples and reliable abnormal simulations can significantly improve the accuracy of subsequent model anomaly detection. It should be noted that the anomaly synthesis network only plays a role during the training phase.

[0041] In one embodiment, the teacher feature extraction network includes a ResNet18 convolutional neural network pre-trained on a large natural image dataset, wherein the ResNet18 convolutional neural network has fixed weights and the final convolutional modules have been removed.

[0042] Specifically, the teacher feature extraction network is a ResNet18 network pre-trained on ImageNet with fixed weights. The output feature maps are selected from the output feature maps of the first three convolutional layers of ResNet18 (i.e., conv2, conv3, conv4), denoted as T1, T2, and T3, respectively, to serve as supervision for the variable denoising student network.

[0043] In one embodiment, the variable denoising student network includes a denoising module and a self-supervised reconstruction module. The denoising module is used to denoise the input image along the feature dimension to obtain a preliminary denoised feature map. The self-supervised reconstruction module is used to further reconstruct the preliminary denoised feature map and generate discriminative features for features with abnormal contextual structure information. The denoising module includes an encoder and a decoder. The encoder uses a randomly initialized ResNet18 convolutional neural network, and the decoder implements an inverse structure through bilinear upsampling. Both the encoder and the decoder include four residual units. The self-supervised reconstruction module includes a variable mask convolution and a channel attention module. The self-supervised reconstruction module uses a masking operation at the center of the convolution and uses contextual information to predict or reconstruct the masked information, thereby forcing the model to learn the global contextual information of normal local features.

[0044] Specifically, the denoising module mainly consists of an autoencoder with a unique encoder-decoder architecture. This trained autoencoder learns only the normal feature representations from the teacher feature extraction network, effectively filtering out anomalies in the feature space. In the autoencoder, the encoder is a randomly initialized ResNet18 network containing four residual blocks. The decoder is an inverse ResNet18 with four residual blocks, and all downsampling operations are replaced with bilinear upsampling. The final output of the denoising module is the feature maps of the last three layers extracted from the decoder, denoted as S1, S2, and S3, respectively.

[0045] like Figure 3 As shown, in one embodiment, the self-supervised reconstruction module consists of a variable mask convolution and a channel attention module. This module employs a masking operation at the center of the convolution and then utilizes contextual information to predict or reconstruct the masked information, thereby forcing the model to learn global contextual information of normal local features.

[0046] In this example, the kernel size of the variable mask convolution is 2×2. Let p be the masked feature location, and x(p) be the masked feature. The calculation process of the reconstructed feature Z(p) is as follows:

[0047]

[0048] Among them, w n and p n Let Δp represent the weight at position n and the initially specified offset, respectively. n and Δm n These are the learnable offset factor and scaling factor for the nth position, respectively, with scaling factor Δm. n Within the range [0,1]. Since p+p n +Δpn It is usually a fraction, so bilinear interpolation is performed first in the calculation, and then x(p+p) is calculated. n +Δp n ), Δp n and Δm n Both are obtained by applying a single convolutional layer to the same input feature map x. This convolutional layer has the same spatial resolution and dilation as the current convolutional layer, and its output has 3N channels, where the first 2N channels correspond to the learned offset Δp. n The remaining N channels are further fed into a sigmoid layer to obtain the scaling factor Δm. n The Sigmoid layer is a commonly used activation function layer that maps input values ​​to the interval (0,1). The formula for the Sigmoid function is:

[0049]

[0050] In this formula, x is the input value, and σ(x) is the output value. By applying the input value to the sigmoid function, a scaling factor Δm can be obtained. n The scaling factor ranges from 0 to 1. These scaling factors can be used in subsequent calculations or as weights to adjust the contribution of input features.

[0051] The output of the deformable mask convolution is processed by a channel attention module, which computes an attention score for each channel. This mechanism utilizes global information to selectively emphasize or suppress reconstructed features. Specifically, the channel attention module first performs global pooling along the channel dimension Z to obtain a feature vector z∈R. c Where R represents the set of real numbers, c represents the number of channels in the feature map, and z∈R c Let represent the set of all feature vectors consisting of c elements. Then, the attention score vector s∈R c The calculation method is as follows:

[0052] s=σ(W2·δ(W1·z))

[0053] Here, σ represents the sigmoid activation function, and δ represents the ReLU activation function, which is a commonly used activation function. Its formula is: ReLU(x) = max(0,x). and This represents the weight matrix of two fully connected layers, where the number of neurons in the first fully connected layer is... Information is reduced by scaling down by a factor r. Then, the attention score vector s is copied spatially to generate a tensor S of the same size as Z. Finally, S and Z are multiplied element-wise to obtain the final reconstructed feature map Y∈R. h×w×c Where h represents height, w represents width, and c represents the number of channels.

[0054] In one embodiment, the pixel-level anomaly segmentation network includes two residual blocks and a hollow spatial pyramid pooling module, wherein the hollow spatial pyramid pooling module is used to adaptively focus on important feature channels and generate anomaly segmentation maps for anomaly detection.

[0055] The channel-aware dilated spatial pyramid pooling mechanism adaptively focuses on important feature channels, enhancing the understanding and attention to key feature channels for more effective small target anomaly detection and localization tasks. Specifically, after receiving the input feature map, the channel-aware dilated spatial pyramid pooling mechanism passes it through four dilated convolutional modules with kernel sizes of 3 and dilation rates of 1, 6, 12, and 18, respectively. These feature maps are then concatenated, followed by global average pooling and global max pooling operations, and then concatenated again before being processed by a multilayer perceptron. Finally, the processed feature map is multiplied by the feature map before the global average pooling and global max pooling operations and input into the scoring head.

[0056] The scoring head consists of a convolutional module with a kernel size of 3, a normalization layer, an activation function, and a convolutional module with a kernel size of 1. In the pixel-level anomaly scoring network, the scoring head's role is to generate a scoring map for anomaly detection.

[0057] S300. Train the anomaly detection model using the training set.

[0058] In one embodiment, the training of the anomaly detection model using the training set is divided into two stages, including:

[0059] In the first stage, only the variable denoising student network is trained. The fake abnormal image is synthesized by the abnormal synthesis network and then input into the variable denoising student network. The normal image in the training set is input into the teacher feature extraction network to minimize the difference in output features between the two, thereby training the variable denoising student network's ability to remove abnormal features.

[0060] Phase 1 total loss function L S It is obtained by weighted summation of the two losses, and the formula is shown below.

[0061] L S =L cos +λL dmcab

[0062] Among them, L cos The formula used to reduce the distance between teacher and student networks is shown below:

[0063]

[0064] Where S k and T k Let i and j represent the output feature maps of the variable denoising student network and the teacher feature extraction network at the k-th layer, respectively, where i and j represent the spatial coordinates on the feature maps, and H represents the output feature maps. k and W k Let S and T represent their height and width, respectively, and D represent the cosine distance between them. Both S and T have three feature maps at different scales, namely S1, S2, S3 and T1, T2, T3 as defined above.

[0065] L dmcab Let L be the loss term of the self-supervised reconstruction module, which is the cosine distance between the input feature map X and the reconstructed feature map Y. λ is a hyperparameter, λ∈(0,1), used to balance the influence of the two loss terms. Gradient descent is used to minimize the total loss function L. S The weights of the variable denoising student network are updated in the following direction until the preset total number of training rounds in the first stage is reached, thus obtaining the trained variable denoising student network.

[0066] In the second stage, the variable denoising student network is kept fixed, and only the pixel-level anomaly segmentation network is trained. Forged anomaly images are synthesized through the anomaly synthesis network and then input into both the variable denoising student network and the teacher feature extraction network, with the corresponding binary anomaly mask serving as the true label for the segmentation network. The pixel-level anomaly segmentation network is trained by comparing the feature map differences between the variable denoising student network and the teacher feature extraction network to identify anomaly regions.

[0067] The focal loss and L1 loss are calculated based on the pixel-level anomaly segmentation network, and a second loss function is calculated based on the focal loss and the L1 loss.

[0068] Specifically, first, the feature map (S) is calculated. k ,T k The cosine similarity of k, k = 1, 2, 3, denoted as C k The features are upsampled to one-quarter of the input size, and then concatenated along the channel dimension before being fed into the pixel-level segmentation network. The output of the pixel-level segmentation network is the predicted anomaly mask, denoted as . Its size is the same as the input. Simultaneously, the anomaly mask is downsampled to the same size, denoted as M. Segmentation training employs a focus loss L.focal Optimize using L1 loss. Focus loss L focal The calculation formula is as follows.

[0069]

[0070] in λ is the focusing parameter.

[0071] The formula for calculating L1 loss is as follows:

[0072]

[0073] Where M represents the actual anomaly mask. This represents the predicted anomaly mask, where i and j represent spatial coordinates.

[0074] The total loss function for the second stage is the sum of the two loss terms mentioned above.

[0075] L seg =L facal +L1

[0076] Use the gradient descent algorithm to minimize the total loss function L. seg The weights of the pixel-level anomaly segmentation network are updated in the following direction until the preset total number of training rounds in the second stage is reached, resulting in the trained pixel-level anomaly segmentation network.

[0077] S400. The trained anomaly detection model is validated using the test set.

[0078] To validate the anomaly detection model provided in this implementation, the MVTEC AD dataset was used. The MVTEC AD dataset is a publicly available dataset for industrial vision inspection tasks, specifically designed to evaluate the performance of anomaly detection algorithms. It contains 15 categories and a total of 5354 high-resolution images. Of these, 3629 are anomaly-free images used for training, and 1725 images (including both normal and anomaly images) were used for testing.

[0079] Using mean precision (AP) as the evaluation metric, we plotted a PR curve with recall on the horizontal axis and precision on the vertical axis. The area under the PR curve is defined as AP. The formulas for calculating precision and recall are as follows:

[0080]

[0081]

[0082] Where TP represents the number of defective samples that were accurately identified as defective, FP represents the number of non-defective samples that were incorrectly identified as defective, and FN represents the number of defective samples that were incorrectly identified as non-defective.

[0083] After verifying that the requirements are met, the anomaly detection target model is output.

[0084] After training the anomaly detection model, the model is validated using a test set. When the validation accuracy reaches a preset threshold, a qualified anomaly detection target model is obtained, which can then be used to perform anomaly detection on industrial images.

[0085] In one embodiment, the deep learning model is trained in 5000 rounds, with the first 1000 rounds focusing on training the anomaly removal ability of the student feature extraction network. The following 4000 rounds focus on training the pixel-level anomaly segmentation network. After every 1000 rounds of training, the model is evaluated using a test set, and the model weights are saved. Finally, the model that performs best on the test set is selected for deployment. This ensures that the entire anomaly detection system achieves optimal performance in practical applications. After training, the best-performing model is deployed to achieve real-time detection of surface defects in industrial products.

[0086] The scope of protection of the unsupervised industrial anomaly detection method based on knowledge distillation described in this embodiment is not limited to the execution order of the steps listed in this embodiment. Any solution implemented by adding, subtracting, or replacing steps in the prior art based on the principle of this invention is included within the scope of protection of this invention.

[0087] This invention discloses an unsupervised industrial anomaly detection method based on knowledge distillation, which uses the anomaly detection target model established by the above-mentioned unsupervised industrial anomaly detection method based on knowledge distillation to detect surface defects in industrial products.

[0088] Since the detection process of the knowledge distillation-based unsupervised industrial anomaly detection method is based on the anomaly detection target model established by the above-mentioned knowledge distillation-based unsupervised industrial anomaly detection method to detect surface defects in industrial products, it will not be elaborated here.

[0089] This invention also provides an unsupervised industrial anomaly detection system based on knowledge distillation. The unsupervised industrial anomaly detection system based on knowledge distillation can implement the unsupervised industrial anomaly detection method based on knowledge distillation described in this invention. However, the implementation device of the unsupervised industrial anomaly detection method based on knowledge distillation described in this invention includes, but is not limited to, the structure of the unsupervised industrial anomaly detection system based on knowledge distillation listed in this embodiment. All structural modifications and substitutions of the prior art made according to the principles of this invention are included within the protection scope of this invention.

[0090] like Figure 4 As shown, in one embodiment, the present invention provides an unsupervised industrial anomaly detection system based on knowledge distillation, the system comprising:

[0091] The preprocessing unit 401 is used to acquire an image of the surface of an industrial product and to preprocess the image to obtain a training set and a test set, respectively.

[0092] Integration unit 402 is used to construct an anomaly synthesis network, a teacher feature extraction network, a variable denoising student network, and a pixel-level anomaly segmentation network, and sequentially integrates the anomaly synthesis network, the teacher feature extraction network, the variable denoising student network, and the pixel-level anomaly segmentation network to form an anomaly detection model.

[0093] Training unit 403 is used to train the anomaly detection model using the training set.

[0094] The verification unit 404 is used to verify the trained anomaly detection model using the test set, and outputs the anomaly detection target model after the verification meets the requirements.

[0095] The anomaly synthesis network is used to synthesize fake abnormal images, the teacher feature extraction network is used to extract multi-scale features of the image and perform feature guidance, the variable denoising student network is used to denoise abnormal regions of the image, and the pixel-level anomaly segmentation network is used to classify and locate anomalies in the image.

[0096] It should be noted that the structure and principle of the preprocessing unit 401, the integration unit 402, the training unit 403 and the verification unit 404 correspond one-to-one with the steps (steps S100 to S400) in the above-mentioned unsupervised industrial anomaly detection method based on knowledge distillation. Their specific working principles can also be referred to the introduction of the unsupervised industrial anomaly detection method based on knowledge distillation in the foregoing embodiments, so they will not be repeated here.

[0097] In the embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, or methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules / units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or modules or units may be electrical, mechanical, or other forms.

[0098] The modules / units described as separate components may or may not be physically separate. The components shown as modules / units may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules / units can be selected to achieve the objectives of the embodiments of the present invention, depending on actual needs. For example, the functional modules / units in the various embodiments of the present invention may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.

[0099] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0100] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.

[0101] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. An unsupervised industrial anomaly detection method based on knowledge distillation, characterized in that, The method includes: Acquire surface images of industrial products, and preprocess the surface images of industrial products to obtain training sets and test sets respectively; An anomaly synthesis network, a teacher feature extraction network, a variable denoising student network, and a pixel-level anomaly segmentation network are constructed. The anomaly synthesis network, the teacher feature extraction network, the variable denoising student network, and the pixel-level anomaly segmentation network are then integrated sequentially to form an anomaly detection model. The variable denoising student network includes a denoising module and a self-supervised reconstruction module. The denoising module is used to denoise the input image in the feature dimension to obtain a preliminary denoised feature map. The self-supervised reconstruction module is used to further reconstruct the preliminary denoised feature map and generate discriminative features for features with abnormal contextual structure information. The self-supervised reconstruction module includes a variable mask convolution and a channel attention module. The self-supervised reconstruction module uses a mask operation at the center of the convolution and uses context information to predict or reconstruct the masked information, thereby forcing the model to learn the global context information of normal local features. The anomaly detection model is trained using the training set. The trained anomaly detection model is validated using the test set, and the anomaly detection target model is output after the validation meets the requirements. The anomaly synthesis network is used to synthesize fake abnormal images, the teacher feature extraction network is used to extract multi-scale features of the image and perform feature guidance, the variable denoising student network is used to denoise abnormal regions of the image, and the pixel-level anomaly segmentation network is used to classify and locate anomalies in the image.

2. The unsupervised industrial anomaly detection method based on knowledge distillation according to claim 1, characterized in that, The preprocessing of the surface images of the industrial products to obtain training and testing sets includes: The images of the industrial product surface are classified according to image category to obtain images of multiple categories; The surface images of the industrial products are subjected to data augmentation processing according to different categories to obtain enhanced images; Images without anomalies in the enhanced images are selected as the training set, and enhanced images with anomalies and their corresponding anomaly mask images are selected as the test set.

3. The unsupervised industrial anomaly detection method based on knowledge distillation according to claim 1, characterized in that, The anomaly synthesis network generates random two-dimensional Perlin noise and binarizes it to create an anomaly mask. It then mixes an anomaly-free image with an image from an external data source at random opacity to generate a simulated anomaly image.

4. The unsupervised industrial anomaly detection method based on knowledge distillation according to claim 1, characterized in that, The teacher feature extraction network includes a ResNet18 convolutional neural network pre-trained on a large natural image dataset, wherein the ResNet18 convolutional neural network has fixed weights and the final convolutional modules have been removed.

5. The unsupervised industrial anomaly detection method based on knowledge distillation according to claim 1, characterized in that, The denoising module includes an encoder and a decoder. The encoder uses a randomly initialized ResNet18 convolutional neural network, and the decoder implements an inverse structure through bilinear upsampling. Both the encoder and the decoder include four residual units.

6. The unsupervised industrial anomaly detection method based on knowledge distillation according to claim 1, characterized in that, The pixel-level anomaly segmentation network includes two residual blocks and a hollow spatial pyramid pooling module. The hollow spatial pyramid pooling module is used to adaptively focus on important feature channels and generate anomaly segmentation maps for anomaly detection.

7. The unsupervised industrial anomaly detection method based on knowledge distillation according to claim 1, characterized in that, The step of training the anomaly detection model using the training set includes: The weights in the anomaly detection model are kept fixed. A fake anomaly image is synthesized through the anomaly synthesis network and then input into the variable denoising student network. Normal images in the training set are input into the teacher feature extraction network to calculate the first loss function. The variable denoising student network is kept fixed. After the forged abnormal image is synthesized by the anomaly synthesis network, it is input into the variable denoising student network and the teacher feature extraction network respectively. The pixel-level anomaly segmentation network is trained by comparing the feature map differences between the variable denoising student network and the teacher feature extraction network to identify abnormal regions. The focal loss and L1 loss are calculated based on the pixel-level anomaly segmentation network, and a second loss function is calculated based on the focal loss and the L1 loss.

8. An unsupervised industrial anomaly detection method based on knowledge distillation, characterized in that, The anomaly detection target model established by the knowledge distillation-based unsupervised industrial anomaly detection method according to any one of claims 1 to 7 is used to detect surface defects in industrial products.

9. An unsupervised industrial anomaly detection system based on knowledge distillation, characterized in that, The system includes: A preprocessing unit is used to acquire images of the surface of industrial products and preprocess the images of the surface of industrial products to obtain training sets and test sets respectively. An integration unit is used to construct an anomaly synthesis network, a teacher feature extraction network, a variable denoising student network, and a pixel-level anomaly segmentation network, and to sequentially integrate the anomaly synthesis network, the teacher feature extraction network, the variable denoising student network, and the pixel-level anomaly segmentation network to form an anomaly detection model; The variable denoising student network includes a denoising module and a self-supervised reconstruction module. The denoising module is used to denoise the input image in the feature dimension to obtain a preliminary denoised feature map. The self-supervised reconstruction module is used to further reconstruct the preliminary denoised feature map and generate discriminative features for features with abnormal contextual structure information. The self-supervised reconstruction module includes a variable mask convolution and a channel attention module. The self-supervised reconstruction module uses a mask operation at the center of the convolution and uses context information to predict or reconstruct the masked information, thereby forcing the model to learn the global context information of normal local features; the training unit is used to train the anomaly detection model using the training set. The verification unit is used to verify the trained anomaly detection model using the test set, and outputs the anomaly detection target model after the verification meets the requirements. The anomaly synthesis network is used to synthesize fake abnormal images, the teacher feature extraction network is used to extract multi-scale features of the image and perform feature guidance, the variable denoising student network is used to denoise abnormal regions of the image, and the pixel-level anomaly segmentation network is used to classify and locate anomalies in the image.

Citation Information

Patent Citations

  • Gear surface defect detection method based on RDMS

    CN117173098A

  • Improved DeSTSeg-based unsupervised grain defect anomaly detection method

    CN118469912A