Multi-category industrial image anomaly detection method and device based on three-tower knowledge distillation architecture
By adopting a three-tower knowledge distillation architecture and a combination of feature distillation and alignment losses, the problem of poor abnormal detection performance of multi-category industrial images in the prior art is solved, and efficient abnormal detection and positioning is achieved in multiple-category scenarios, avoiding linear growth in model number and storage cost.
Patent Information
- Application Number
- CN202411728285.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-14
AI Technical Summary
The existing knowledge distillation network based on the dual-tower architecture performs poorly in multi-category industrial image anomaly detection scenarios, and lacks the ability to model and express multiple-category samples, resulting in a degradation in the performance of the model in the joint anomaly detection scenario.
The three-tower knowledge distillation architecture is adopted, including a local context student network, a global context student network and a pre-trained teacher network. The characteristics output by the student network are consistent with the teacher network through feature distillation loss and feature alignment loss, which improves the model's ability to learn multi-category normal image feature representation.
It realizes that when only normal industrial product images are used for training, an abnormality detection and positioning of multiple industrial products is used for training, avoiding the linear increase in the number of models and storage costs of the product category, and improving the performance of the model in joint anomaly detection scenarios.
Smart Images

Figure CN119625412A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image recognition technology, and specifically relates to a multi-category industrial image anomaly detection method and device based on a three-tower knowledge distillation architecture. Background Art
[0002] In the industrial field, anomaly detection and location are important tasks in intelligent manufacturing. They mainly use artificial intelligence methods to automatically identify surface defects of defective products, while taking into account accuracy and efficiency, saving a lot of labor costs and ensuring a safer and smarter production environment. However, in practical applications, they are often subject to certain limitations, such as the scarcity of abnormal samples in industrial products and the complexity and diversity of abnormal types. A common solution is to use an unsupervised learning method to model and learn only normal samples, and identify abnormal areas by calculating abnormal scores for samples in the test set. Among them, the knowledge distillation-based methods are mostly designed with a dual-tower architecture, that is, by training a single student network to imitate the output of the teacher network on normal images, and detecting anomalies based on the assumption that the student network is difficult to predict the output of the teacher network on abnormal data. In addition, most of the existing student-teacher methods for anomaly detection follow the "single category-single model" model, that is, different student-teacher models need to be trained for samples of different product categories, and each model of a specific category can only detect abnormal samples in that category in a targeted manner. However, in the industrial field, the huge number of product categories will require a large number of corresponding models to be trained and stored, and the cost of this is linearly increasing with the number of categories. In contrast, a more suitable model for industrial scenarios is the "multi-category-single model" joint anomaly detection, that is, learning a unified model on normal samples covering multiple product categories, so that the unified model has the ability to detect anomalies on multiple product categories at the same time. In such a joint anomaly detection scenario, the existing knowledge distillation network based on the dual-tower architecture is often limited by the model's own design and lacks the ability to model and express multi-category samples, resulting in poor performance in the joint anomaly detection scenario. Summary of the invention
[0003] The purpose of the present invention is to provide a multi-category industrial image anomaly detection method based on a three-tower knowledge distillation architecture, which can realize anomaly detection and positioning of multiple categories of industrial products using a unified student-teacher model (multi-category-single model) when only normal industrial product images are used for training, without the need to train models separately for different categories of products (single category-single model), thereby avoiding the linear growth of the number of models and storage costs with the increase of product categories.
[0004] In order to achieve the above object, the technical solution adopted by the present invention is: to provide a multi-category industrial image anomaly detection method based on a three-tower knowledge distillation architecture, comprising the following steps: For the multi-category industrial image data to be detected, after preprocessing, it is input into the trained multi-category anomaly detection unified model based on the three-tower knowledge distillation network architecture to extract the feature difference map between the features obtained by the teacher network and the local context student network, the feature difference map between the features obtained by the teacher network and the global context student network, and the feature difference map between the features obtained by the local context student network and the global context student network; Based on the above three feature difference maps, calculate the pixel-level anomaly score map and determine whether the image has an abnormality, and calculate the abnormal score at the abnormal image level to locate the abnormal area for the abnormal image; The unified multi-category anomaly detection model based on the three-tower knowledge distillation network architecture includes a local student network, a global student network and a pre-trained teacher network; the local context student network uses local context features to predict and output local feature representations; the global context student network uses global context features to predict and acquire feature representations; the pre-trained teacher network is a model pre-trained on a large-scale dataset.
[0005] Furthermore, the training of the unified model for multi-category anomaly detection based on the three-tower knowledge distillation network architecture includes the following steps: Industrial images of different product categories are mixed into a unified dataset; the images of the unified dataset are all normalized to the same size; A multi-category anomaly detection network based on a three-tower knowledge distillation network architecture is constructed. The multi-category anomaly detection network based on the three-tower knowledge distillation network architecture includes a three-tower architecture of a local context student network, a global context student network, and a pre-trained teacher network, which output three different feature representations respectively; the pre-trained teacher network is pre-trained on a large-scale dataset. Model; the local context student network is composed of a local self-attention encoder and a fully connected prediction head; the global context student network is composed of a global self-attention encoder and a fully connected prediction head; Based on the training set of multi-category normal industrial images in the preprocessed unified dataset, the feature distillation loss is used to constrain the feature representations output by the local context student network and the global context student network to be consistent with the feature representation output by the pre-trained teacher network, and the feature alignment loss is used to constrain the output feature representations between the local context student network and the global context student network to be consistent. For the multi-category industrial image data to be detected, input them into the trained unified multi-category anomaly detection model based on the three-tower knowledge distillation network architecture, obtain the feature representations output by the teacher network, the global context student network, and the local context student network, and obtain three different feature difference maps by calculating the difference between the two. Based on three different feature difference maps, an image-level anomaly score is obtained for identifying abnormal images through a feature difference-based anomaly recognition / localization module, and a pixel-level anomaly score map is obtained for abnormal areas in abnormal images.
[0006] Furthermore, the training set covers normal images of different types of industrial products used for training, and the category information of the products is not used in the training process; the test set covers images of different types of industrial products used for testing, including normal images and abnormal images that do not appear in the training set.
[0007] Furthermore, the local self-attention encoder includes image segmentation, position encoding, layer normalization, a fully connected layer and a designed local context attention module; in the local context attention module, for the features of each target block, the target block is restricted to calculate self-attention only with the context features of a set window size around itself.
[0008] Furthermore, the global self-attention encoder includes image segmentation, position encoding, layer normalization, a fully connected layer and a designed global context attention module. In the global context attention module, for the features of each target block, the context features of a set window size around the target block are masked, and self-attention is calculated with the global area features outside the masked window.
[0009] Furthermore, the fully connected prediction head is a multi-layer perceptron network, the global context student network and the local context student network respectively use two multi-layer perceptron networks as prediction heads, and the two fully connected prediction heads have the same network structure.
[0010] Furthermore, the network model parameters and the number of iterations are set, and the AdamW optimizer is used to minimize the joint training loss and optimize the model parameters. Using feature distillation loss Constrain the feature representations predicted by the two student networks through global and local contexts respectively to be consistent with the feature representations output by the pre-trained teacher; Using feature alignment loss Constrain the consistency between the feature representations output by the global context student network and the local context student network; The joint training loss is a combination of feature distillation loss and feature alignment loss:
[0011] in, is the weight hyperparameter used to balance the two losses.
[0012] Further, based on the above three feature difference maps, a pixel-level anomaly score map is calculated, and it is determined whether the image has an abnormality, and the abnormal image-level anomaly score is calculated. For the abnormal image, the abnormal area is located, including: obtaining a feature difference map between the teacher network and the local context student network, a feature difference map between the teacher network and the global context student network, and a feature difference map between the local context student network and the global context student network. The three feature difference maps are averaged to obtain the average feature difference map; Upsample the average feature difference map to obtain a pixel-level anomaly score map of the original image size; Take the maximum value of the anomaly score map to get the anomaly score at the abnormal image level; The obtained image-level anomaly score is used to distinguish abnormal images from normal images, and the obtained pixel-level anomaly score map is used for abnormal regions in abnormal images.
[0013] The present invention can also provide a computer device, including a processor and a memory, the memory is used to store a computer executable program, the processor reads the computer executable program from the memory and executes it, and when the processor executes the computer executable program, it can implement the multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture described in the present invention.
[0014] At the same time, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture described in the present invention can be implemented.
[0015] Compared with the prior art, the present invention has at least the following beneficial effects: the present invention proposes a multi-category industrial image anomaly detection method based on a three-tower knowledge distillation architecture, which can realize anomaly detection and positioning of multiple categories of industrial products using a unified student-teacher model when only normal industrial product images are used for training, without the need to train models separately for different categories of products, thereby avoiding the linear growth of the number of models and storage costs with the increase of product categories; the present invention designs a three-tower network architecture consisting of a local context student network, a global context student network and a pre-trained teacher network, which improves the model's ability to learn multi-category normal image feature representations and overcomes the performance degradation of the existing knowledge distillation network-based method from the "single category-single model" mode to the "multi-category-single model" mode; at the same time, it has high real-time performance and small model size, and can be applied to industrial anomaly detection scenarios with high real-time requirements; For multi-category normal industrial images used for training, the feature distillation loss is used to constrain the features output by the two student networks to be consistent with the teacher network, and the feature alignment loss is used to constrain the output features between the two student networks that use local and global context areas to predict the central features to be consistent, thereby greatly improving the model's ability to learn multi-category normal image feature representations; for abnormal areas in multi-category industrial images to be detected, the above consistency will be destroyed and a higher anomaly score will be generated, thereby ensuring that the model can perform high-precision detection and positioning of multi-category abnormal samples in the joint anomaly detection scenario.
[0016] Figure content Figure 1 The present invention is a schematic diagram of an implementable process.
[0017] Figure 2 This is a diagram of the three-tower knowledge distillation network architecture proposed by the present invention, which is different from the traditional architecture.
[0018] Figure 3 This is a diagram of the multi-category anomaly detection network framework based on the three-tower knowledge distillation network architecture.
[0019] Figure 4 This is the framework diagram of the local self-attention encoder.
[0020] Figure 5 This is the framework diagram of the global self-attention encoder.
[0021] Figure 6 Schematic diagram of unified model training for multi-category anomaly detection based on the three-tower knowledge distillation network architecture.
[0022] Figure 7 Schematic diagram of the application of a unified model for multi-category anomaly detection based on a three-tower knowledge distillation network architecture.
[0023] Figure 8 This is a framework diagram of the anomaly identification / location module based on feature differences.
[0024] Fig. 9 Schematic diagram of some multi-category normal industrial images used for model training.
[0025] Fig.10 Schematic diagram of using a unified model to locate anomalies in multi-category industrial images. DETAILED DESCRIPTION
[0026] The technical solution of the present invention is described in detail below with reference to the accompanying drawings.
[0027] The present invention discloses a multi-category industrial image anomaly detection method based on a three-tower knowledge distillation architecture, which can realize anomaly detection and location of multi-category industrial products using a unified student-teacher model (multi-category-single model) when only normal industrial product images are used for training, without the need to train models for different categories of products separately (single category-single model), thereby avoiding the linear growth of the number of models and storage costs with the increase of product categories. In order to overcome the performance degradation of the existing knowledge distillation network-based method from the "single category-single model" mode to the "multi-category-single model" mode, such as Figure 2 As shown, the present invention designs a three-tower network architecture covering a local context student network, a global context student network and a pre-trained teacher network. For multi-category normal industrial images used for training, the features output by the two student networks are respectively constrained to be consistent with the teacher network through feature distillation loss, and the output features between the two student networks using local and global context area prediction center features are constrained to be consistent through feature alignment loss, thereby greatly improving the model's ability to learn multi-category normal image feature representations. For abnormal areas in the industrial image to be detected, the above consistency will be destroyed and a higher anomaly score will be generated, thereby ensuring that the model can perform high-precision detection and positioning of multi-category abnormal samples in the joint anomaly detection scenario.
[0028] Example 1: This example describes the process of obtaining a unified model for multi-category anomaly detection based on a three-tower knowledge distillation network architecture, and the implementation process of anomaly detection using the unified model for multi-category anomaly detection.
[0029] As attached Figure 1 As shown in the figure, a multi-category industrial image anomaly detection method based on a three-tower knowledge distillation architecture specifically includes the following steps: S1, preprocessing of multi-category industrial image data Industrial images of different product categories are mixed into a unified data set; the images of the unified data set are all normalized to the same size; the images are color images corresponding to industrial products of different categories; the training set of the unified data set is normal samples from industrial products of different categories, and no category information is used during the training process; the test set is normal samples and abnormal samples from industrial products of different categories that do not appear in the training set, and no category information of the products is used during the training process. Fig. 9 As shown, the training set used for model training covers multiple normal images of 15 different categories of industrial products; S2, building a multi-category anomaly detection network based on a three-tower knowledge distillation network architecture As attached Figure 3As shown in the figure, the entire multi-category anomaly detection network includes a three-tower architecture of a local context student network, a global context student network, and a pre-trained teacher network, which output three different feature representations respectively. , and The pre-trained teacher network is pre-trained on an existing large-scale dataset. Model, Caron M, Touvron H, Misra I, et al., Emerging properties in self-supervised vision transformers [C], Proceedings of the IEEE / CVF international conference on computer vision. 2021: 9650-9660; the local context student network consists of a local self-attention encoder and a fully connected prediction head; the above-mentioned global context student network consists of a global self-attention encoder and a fully connected prediction head.
[0030] As attached Figure 4 As shown, the local self-attention encoder includes image segmentation, position encoding, layer normalization, fully connected layers, and a designed local context attention module. For the features of each target block, the present invention limits each target block to only be associated with a set window size ( ) to calculate the self-attention based on the contextual features, thereby limiting the receptive field of the feature to the local window area. The local self-attention encoder of the present invention is expressed as ,in represents the number of encoder layers, Indicates the local context window size.
[0031] As attached Figure 5 As shown, the global self-attention encoder includes image segmentation, position encoding, layer normalization, fully connected layers, and a designed global context attention module. For the features of each target block, the present invention shields the surrounding area of each target block by setting a window size ( ) and calculates self-attention with the global regional features outside the masking window. This mechanism helps to reduce the overlap of computational areas between global and local contextual attention when calculating the attention map in each module. The present invention represents the global self-attention encoder as ,in represents the number of encoder layers, Indicates the context window size for masking.
[0032] The fully connected prediction head is a multi-layer perceptron network (MLP). In the present invention, two multi-layer perceptron (MLP) networks are used as prediction heads in the global context student network and the local context student network. The two fully connected prediction heads have the same network structure, with the number of layers being , respectively and .
[0033] The feature representations output by the teacher network, the global context student network, and the local context student network are , and ,in: represents the feature representation of the teacher network output, represents the feature representation of the local context student network output, The feature representation representing the output of the global context student network is calculated as follows:
[0034]
[0035] in, represents the input industrial image, represents the size of the input image, The dimension of the feature representation.
[0036] S3, training a unified model for multi-category anomaly detection based on a three-tower knowledge distillation network architecture As attached Figure 6 As shown, based on a training set of multi-category normal industrial images in a preprocessed unified dataset, when the training set is used to train a unified model for multi-category anomaly detection, the feature representations of the outputs of the two student networks are constrained to be consistent with the teacher network through feature distillation loss, and the output feature representations of the two student networks that use local and global context area prediction center features are constrained to be consistent through feature alignment loss, thereby improving the model's ability to learn feature representations of multi-category normal images.
[0037] The above feature distillation loss is used to realize the feature distillation between the global context student network and the local context student network and the pre-trained teacher network, respectively, constraining the feature representation of the global context student network and the local context student network to be consistent with the feature representation output by the pre-trained teacher through the feature representation predicted by the global context and the feature representation predicted by the local context, respectively. The distance metric between their feature representations is defined as follows:
[0038]
[0039] in, As the distillation distance metric, the final distillation loss is defined as:
[0040] in, Indicated in The average value of the three feature dimensions.
[0041] The feature alignment loss is used to constrain the consistency between the feature representations output by the global context student network and the local context student network. The feature distance metric is defined as follows:
[0042] in, As the alignment distance metric, the final feature alignment loss is:
[0043] The final joint training loss is a combination of feature distillation loss and feature alignment loss, calculated as follows:
[0044] in, is the weight hyperparameter used to balance the two losses.
[0045] S4, using a unified model to extract different feature difference maps of multi-category industrial images to be detected As attached Figure 7 As shown, for the multi-category industrial image data to be detected, they are input into the trained multi-category anomaly detection unified model based on the three-tower knowledge distillation network architecture, and the feature representations output by the teacher network, the global context student network and the local context student network are obtained respectively, and three different feature difference maps are obtained by calculating the difference between them.
[0046] The above three different feature difference maps are defined as , and , respectively represent the feature difference map between the features obtained by the teacher network and the local context student network, the feature difference map between the features obtained by the teacher network and the global context student network, and the feature difference map between the features obtained by the local context student network and the global context student network, which are obtained by the following calculations:
[0047]
[0048]
[0049] in, Along the first feature dimension The average function of .
[0050] S5, using feature difference maps for anomaly recognition and localization of multi-category industrial images: As attached Figure 8 As shown, based on three different feature difference maps , and , through the feature difference-based anomaly recognition / location module, the image-level anomaly score is obtained for identifying abnormal images, and the pixel-level anomaly score map is obtained for abnormal areas in abnormal images. The whole process is as follows: First, the three feature difference maps are averaged to obtain the average feature difference map , the calculation process is as follows:
[0051] Then the average feature difference map is upsampled to obtain a pixel-level anomaly score map of the original image size. , the calculation process is as follows:
[0052] Finally, take the maximum value of the anomaly score map to get the anomaly score at the abnormal image level , the calculation process is as follows:
[0053] The resulting image-level anomaly score It is used to distinguish abnormal images from normal images, and the obtained pixel-level abnormal score map Used for abnormal regions in abnormal images.
[0054] As an alternative method, bilinear interpolation can be used to upsample the average feature difference map.
[0055] Example 2, setting specific parameters to implement the process described in Example 1, the size of the input image Set to , the size of the feature representation Set to , ( ) where the number of network layers n is set to 5 and the local window w is set to 3. The number of network layers in is also set to 5, and the masking window h is set to 3. and The number of network layers is set to 1. During training, only the training set covering multiple categories of normal images is used. The AdamW optimizer is used for the joint training loss. After 1000 iterations, the unified model obtained by minimizing and optimizing model parameters can be directly used for anomaly identification and location on a test set containing multiple types of industrial products. Fig.10 The results shown are the results of the training of the unified model of the present invention on the test set to predict the anomaly localization results. The results shown are the results of training on a training set covering multiple categories of normal images, and using this unified model to simultaneously localize anomalies on industrial product images from different categories. It can be seen that the abnormal areas located by the present invention are highly consistent with the true annotations, demonstrating the good performance of the present invention in using a unified student-teacher model to detect and localize anomalies on multiple categories of industrial products.
[0056] In addition, each module in the present invention can achieve good performance with a small number of network layers, has a small model scale and good real-time performance, and can be applied to industrial anomaly detection scenarios with high real-time requirements.
[0057] The present invention proposes a multi-category industrial image anomaly detection method based on a three-tower knowledge distillation architecture, which covers a three-tower architecture of a local context student network, a global context student network, and a pre-trained teacher network. For multi-category normal industrial images used for training, the features output by the two student networks are respectively constrained to be consistent with the teacher network through distillation loss, and the output features between the two student networks using local and global context area prediction center features are constrained to be consistent through feature alignment loss, thereby greatly improving the model's ability to learn multi-category normal image feature representations. For abnormal areas in the multi-category industrial images to be detected, the above consistency will be destroyed and a higher anomaly score will be generated, thereby ensuring that the model performs high-precision detection and positioning of multi-category abnormal samples in the joint anomaly detection scenario, avoiding the performance degradation of the model from the "single category-single model" mode to the "multi-category-single model" mode; in addition, the present invention has high real-time performance and a small model scale, and can be applied to industrial anomaly detection scenarios with high real-time requirements.
[0058] On the other hand, the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it can implement the multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture described in the present invention.
[0059] The present invention can also provide a computer device, including a processor and a memory, the memory is used to store a computer executable program, the processor reads the computer executable program from the memory and executes it, and when the processor executes the computer executable program, it can implement the multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture described in the present invention.
[0060] The computer device may be a laptop computer, a desktop computer or a workstation.
[0061] The processor can be a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), or an off-the-shelf field-programmable gate array (FPGA).
[0062] The memory of the present invention may be an internal storage unit of a laptop computer, a desktop computer or a workstation, such as a memory or a hard disk; or an external storage unit, such as a mobile hard disk or a flash memory card.
[0063] Computer-readable storage media may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer-readable storage media may include: read-only memory (ROM), random access memory (RAM), solid-state drive (SSD) or optical disk, etc. Among them, random access memory may include resistance random access memory (ReRAM) and dynamic random access memory (DRAM).
[0064] The present invention is described by way of embodiments, and various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention for those skilled in the art. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application belong to the protection scope of the present invention.
Claims
1. A multi-category industrial image anomaly detection method based on a three-tower knowledge distillation architecture, characterized in that: The following steps are involved: For the multi-category industrial image data to be detected, after preprocessing, it is input into the trained multi-category anomaly detection unified model based on the three-tower knowledge distillation network architecture to extract the feature difference map between the features obtained by the teacher network and the local context student network, the feature difference map between the features obtained by the teacher network and the global context student network, and the feature difference map between the features obtained by the local context student network and the global context student network; Based on the above three feature difference maps, calculate the pixel-level anomaly score map and determine whether the image has an abnormality, and calculate the abnormal score at the abnormal image level to locate the abnormal area for the abnormal image; The unified multi-category anomaly detection model based on the three-tower knowledge distillation network architecture includes a local student network, a global student network and a pre-trained teacher network; the local context student network uses local context features to predict and output local feature representations; the global context student network uses global context features to predict and acquire feature representations; the pre-trained teacher network is a model pre-trained on a large-scale dataset.
2. The multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture according to claim 1 is characterized in that: The training of the unified multi-category anomaly detection model based on the three-tower knowledge distillation network architecture includes the following steps: Industrial images of different product categories are mixed into a unified dataset; the images of the unified dataset are all normalized to the same size; A multi-category anomaly detection network based on a three-tower knowledge distillation network architecture is constructed. The multi-category anomaly detection network based on the three-tower knowledge distillation network architecture includes a three-tower architecture of a local context student network, a global context student network, and a pre-trained teacher network, which output three different feature representations respectively; the pre-trained teacher network is pre-trained on a large-scale dataset. Model; the local context student network is composed of a local self-attention encoder and a fully connected prediction head; the global context student network is composed of a global self-attention encoder and a fully connected prediction head; Based on the training set of multi-category normal industrial images in the preprocessed unified dataset, the feature distillation loss is used to constrain the feature representations output by the local context student network and the global context student network to be consistent with the feature representation output by the pre-trained teacher network, and the feature alignment loss is used to constrain the output feature representations between the local context student network and the global context student network to be consistent. For the multi-category industrial image data to be detected, input them into the trained unified multi-category anomaly detection model based on the three-tower knowledge distillation network architecture, obtain the feature representations output by the teacher network, the global context student network, and the local context student network, and obtain three different feature difference maps by calculating the difference between the two. Based on three different feature difference maps, an image-level anomaly score is obtained for identifying abnormal images through a feature difference-based anomaly recognition / localization module, and a pixel-level anomaly score map is obtained for abnormal areas in abnormal images.
3. The multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture according to claim 2 is characterized in that: The training set covers normal images of different types of industrial products used for training, and the product category information is not used in the training process; the test set covers images of different types of industrial products used for testing, including normal images and abnormal images that do not appear in the training set.
4. The multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture according to claim 2 is characterized in that: The local self-attention encoder includes image segmentation, position encoding, layer normalization, a fully connected layer and a designed local context attention module; in the local context attention module, for the features of each target block, the target block is restricted to calculate self-attention only with the context features of a set window size around itself.
5. The multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture according to claim 2 is characterized in that: The global self-attention encoder includes image segmentation, position encoding, layer normalization, a fully connected layer and a designed global context attention module. In the global context attention module, for the features of each target block, the context features of a set window size around the target block are masked, and self-attention is calculated with the global area features outside the masked window.
6. The multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture according to claim 2 is characterized in that: The fully connected prediction head is a multi-layer perceptron network, the global context student network and the local context student network respectively use two multi-layer perceptron networks as prediction heads, and the two fully connected prediction heads have the same network structure.
7. The multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture according to claim 2 is characterized in that: Set the network model parameters and number of iterations, use the AdamW optimizer to minimize the joint training loss and optimize the model parameters. Using feature distillation loss Constrain the feature representations predicted by the two student networks through global and local contexts respectively to be consistent with the feature representations output by the pre-trained teacher; Using feature alignment loss Constrain the consistency between the feature representations output by the global context student network and the local context student network; The joint training loss is a combination of feature distillation loss and feature alignment loss: in, is the weight hyperparameter used to balance the two losses.
8. The multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture according to claim 1 is characterized in that: Based on the above three feature difference maps, the pixel-level anomaly score map is calculated, and it is judged whether the image has an abnormality, and the abnormal image-level anomaly score is calculated. For the abnormal image, the abnormal area is located, including: obtaining the feature difference map between the teacher network and the local context student network, the feature difference map between the teacher network and the global context student network, and the feature difference map between the local context student network and the global context student network. The three feature difference maps are averaged to obtain the average feature difference map; Upsample the average feature difference map to obtain a pixel-level anomaly score map of the original image size; Take the maximum value of the anomaly score map to get the anomaly score at the abnormal image level; The obtained image-level anomaly score is used to distinguish abnormal images from normal images, and the obtained pixel-level anomaly score map is used for abnormal regions in abnormal images.
9. A computer device, characterized in that: It includes a processor and a memory, the memory is used to store computer executable programs, the processor reads part or all of the computer executable programs from the memory and executes them, and when the processor executes part or all of the computer executable programs, it can implement the multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: A computer program is stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the multi-category industrial image anomaly detection method based on the three-tower knowledge distillation architecture as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Knowledge distillation anomaly detection method based on asymmetric teacher-student network
CN117593602A
Cited By
Monocular three-dimensional target sensing method and system based on selective knowledge distillation
CN120543827A
Industrial anomaly detection method and device based on multi-feature fusion
CN120833310A
An industrial anomaly detection method and device based on multi-feature fusion
CN120833310B
Multi-class anomaly detection method based on continuous class prompt
CN122473197A
A multi-class anomaly detection method based on continuous category hints
CN122473197B