Industrial image defect detection method

Through multiple teacher networks, students' networks are trained and bidirectional feature mapping modules and contrast loss functions are used, the problem of insufficient expression of students' network features is solved, the accuracy and reliability of industrial image defect detection is improved, and high-precision detection effect is achieved .

CN119205618APending Publication Date: 2024-12-27GUIZHOU UNIV +2
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411093175.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

In the existing industrial image defect detection model, the student network and the teacher network adopt the same or similar network architecture, resulting in insufficient diversity of abnormal features expression in the student network, resulting in missed or missed detection, and the teacher and student networks are feature extraction. Differences in expression ability affect model accuracy.

Method used

Multiple teacher networks are used to train a student network, and through the two-way feature mapping module and contrast loss function, the feature expression ability of the student network and the difference between the teacher and student network output is increased, and the model parameters are optimized to improve detection performance.

Benefits of technology

High-precision industrial image defect detection is realized, and a student network with a complete knowledge system is trained through multiple angles, which improves detection performance and reliability and reduces detection errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119205618A_ABST
    Figure CN119205618A_ABST
Patent Text Reader

Abstract

The invention discloses an industrial image defect detection method, which comprises the following steps that an industrial image defect detection model is constructed, and the industrial image defect detection model comprises a plurality of teacher networks, student networks and a bidirectional feature mapping module; generating a synthesis abnormal image set; training an industrial image defect detection model, constructing a contrast loss function, and optimizing parameters of the industrial image defect detection model; and inputting the to-be-detected image into the industrial image defect detection model to obtain a detection result. According to the invention, high-precision industrial image defect detection is realized, a plurality of teacher networks are utilized to train a student network, and a bidirectional feature mapping module is added between the teacher network and the student network to relieve the huge difference between model capabilities of the teacher network and the student network. And the difference between network output features of teachers and students is increased by comparing loss functions, so that the industrial image defect detection model is more accurate during detection and has stronger detection performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image defect detection, and in particular relates to an industrial image defect detection method. Background Art

[0002] In technical fields such as industrial product surface quality inspection, online intelligent detection system for industrial image defects, and product classification, actual industrial product images are mainly used to train and learn deep learning algorithm models, so that the network model can quickly and accurately detect and locate defects and the location of defects in complex industrial images, thereby greatly reducing the time and resources of manual quality inspection, while also maintaining efficient and accurate detection results.

[0003] In traditional image defect anomaly detection models based on knowledge distillation, the teacher and student networks mostly use the same or similar network architecture, which greatly hinders the diversity of the student network's anomaly representation, causing the student network to highly generalize the same anomaly features as the teacher network, reducing the difference between the teacher and student models, resulting in missed detections or false detections in the detection method.

[0004] For example, the paper Student-Teacher Feature Pyramid Matching for Unsupervised Anomaly Detection on arXiv proposed a defect anomaly detection algorithm based on teacher-student feature pyramid matching, namely STPM. Figure 7 As shown in the figure, the teacher network uses pre-trained ResNet-18 as the network backbone, and the student network uses untrained ResNet-18 as the network. ResNet-18 includes one convolution and three convolution blocks to form a pyramid-like structure. The network achieves accurate detection of industrial image defects under the supervision of the feature pyramid.

[0005] Although STPM can effectively learn shallow and deep features of the network under the supervision of a multi-layer feature pyramid, so that the student network can quickly learn the feature knowledge of the teacher network, thereby realizing the detection and location of defects and anomalies in industrial images. However, the teacher and student networks use the same or similar network architecture, which limits the innovation and diversity of the student network's feature expression, resulting in a small difference in the final output of the two, causing problems such as missed detection of subtle and complex defects or edge defects. At the same time, since there is only one teacher network, and the teacher network is a pre-trained network, and the student network uses an untrained network, there are huge differences between the two in terms of feature extraction capabilities and network expression capabilities. The use of one-step knowledge distillation will cause the student network to misunderstand or bias the feature knowledge of the teacher network, thereby affecting the training or learning of the student network. This affects the accuracy of the network model and leads to inaccurate detection and location of defects and anomalies in industrial images. Summary of the invention

[0006] In order to solve the above technical problems, the present invention provides an industrial image defect detection method.

[0007] The present invention is achieved through the following technical solutions.

[0008] The present invention provides an industrial image defect detection method, comprising the following steps:

[0009] S1. Obtain an image to be detected and load an industrial image defect detection model, wherein the industrial image defect detection model includes a plurality of teacher networks, a student network, a contrast loss function and a bidirectional feature mapping module;

[0010] S2. Input the image to be detected into the industrial image defect detection model to obtain the detection result.

[0011] Preferably, the teacher network supports a pre-trained CNN network;

[0012] The student network supports a custom CNN network based on VGG16.

[0013] Preferably, before the loading, constructing the industrial image defect detection model comprises the following steps:

[0014] S10, build industrial image defect detection model;

[0015] S20, obtaining an industrial image training set, and generating a synthetic abnormal image set according to the industrial image training set, wherein the images in the industrial image training set and the images to be detected are of the same type;

[0016] S30. Train the industrial image defect detection model by synthesizing an abnormal image set, construct a contrast loss function, and optimize the parameters of the industrial image defect detection model.

[0017] Preferably, generating a synthetic abnormal image set according to an industrial image training set specifically refers to: generating a synthetic abnormal image set according to an abnormal simulation strategy from an industrial image training set.

[0018] Preferably, the S30, training the industrial image defect detection model by synthesizing the abnormal image set, constructing the contrast loss function, and optimizing the parameters of the industrial image defect detection model comprises the following steps:

[0019] S301, selecting an image in the synthetic abnormal image set as a training image;

[0020] S302, input the training image into the industrial image defect detection model, obtain the multi-layer fusion features of the teacher network, and obtain the multi-layer features of the student network;

[0021] S303, bidirectionally mapping the multi-layer fusion feature matrix of the teacher network and the multi-layer features of the student network through a bidirectional feature mapping module to obtain a mapped feature representation;

[0022] S304, constructing a contrast loss function according to the multi-layer fusion features of the teacher network, the multi-layer features of the student network and the mapped feature representation;

[0023] S305, optimizing parameters of the industrial image defect detection model by contrast loss function;

[0024] S306. Select an image that has not been selected in the synthetic abnormal image set as a training image, and repeat steps S302 to S305 until the performance of the industrial image defect detection model reaches the best.

[0025] Preferably, the step of obtaining the multi-layer fusion features of the teacher network comprises the following steps:

[0026] Input the synthetic abnormal image into the teacher network to obtain the multi-layer features of the teacher network;

[0027] The multi-layer features of the teacher network are averaged between pixels according to the layers with the same corresponding resolution size to obtain multi-layer fusion features.

[0028] Preferably, the bidirectional feature mapping module includes a teacher feature mapping submodule and a student feature mapping submodule;

[0029] The bidirectional mapping of the multi-layer fusion features of the teacher network and the multi-layer features of the student network through the bidirectional feature mapping module specifically refers to: unidirectionally mapping the multi-layer fusion features of the teacher network to the feature level of the student network through the teacher feature mapping submodule, unidirectionally mapping the multi-layer features of the student network to the feature level of the teacher network through the student feature mapping submodule, and then performing feature matching on the same feature level.

[0030] Preferably, the step S304, constructing a contrast loss function according to the multi-layer fusion features of the teacher network, the multi-layer features of the student network and the mapped feature representation, comprises the following steps:

[0031] Normalizing the multi-layer fusion features of the teacher network, the multi-layer features of the student network, and the mapped feature representation to obtain a normalized feature representation;

[0032] Constructing a normal pixel set and a synthetic abnormal pixel set based on the normalized feature representation;

[0033] Define the teacher domain and student domain;

[0034] A distance function is defined according to the normal pixel set and the synthetic abnormal pixel set, wherein the distance function includes a distance function of a teacher domain and a distance function of a student domain;

[0035] A contrastive loss function is constructed according to the distance function, wherein the contrastive loss function includes a loss function of a teacher domain and a loss function of a student domain.

[0036] Preferably, the mapped feature representation includes: a feature representation after multi-layer fusion feature mapping of the teacher network and a feature representation after multi-layer feature mapping of the student network;

[0037] The teacher domain refers to a feature space composed of multi-layer fusion features of the teacher network and multi-layer feature mapping of the student network;

[0038] The student domain refers to a feature space composed of feature representations after multi-layer features of the student network and multi-layer fusion feature mapping of the teacher network;

[0039] Defining the distance function refers to: using Smoth L1loss to define the distance function between features in the same domain.

[0040] Preferably, the step S305 of optimizing the parameters of the industrial image defect detection model by using a contrast loss function comprises the following steps:

[0041] Construct the total loss function by comparing the loss functions;

[0042] Optimize the student network parameters and bidirectional feature mapping module parameters according to the total loss function;

[0043] The detection performance of the model is represented by the image-level AUROC value until the performance of the industrial image defect detection model reaches the best, and the positioning performance is represented by the pixel-level AUROC value.

[0044] The beneficial effects of the present invention are:

[0045] 1. The present invention realizes high-precision industrial image defect detection and uses multiple teacher networks to train a student network. Multiple teacher networks can extract image information from multiple angles, thereby training a student network with a complete knowledge system, making the industrial image defect detection model more accurate and having stronger detection performance.

[0046] 2. Abandoning the traditional student network that uses the same or similar network architecture as the teacher network, the student network is redesigned to improve its ability to express abnormal features; a bidirectional feature mapping module is added between the teacher and student networks to alleviate the huge difference in model capabilities between the teacher and student networks, and the difference between the output features of the teacher and student networks is increased by comparing the loss function, thereby improving the reliability of industrial image defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1is a flow chart of a training method provided by an embodiment of the present invention;

[0048] Figure 2 It is a schematic diagram of the network framework structure provided by an embodiment of the present invention;

[0049] Figure 3 is a schematic diagram of a student network structure provided by an embodiment of the present invention;

[0050] Figure 4 Schematic diagram of the framework structure of a bidirectional feature mapping module provided by an embodiment of the present invention;

[0051] Figure 5 Schematic diagram of the contrast loss function provided by an embodiment of the present invention;

[0052] Figure 6 It is a schematic diagram of experimental results provided by an embodiment of the present invention;

[0053] Figure 7 It is a schematic diagram of the network framework structure of the prior art. DETAILED DESCRIPTION

[0054] The technical solution of the present invention is further described below, but the scope of protection claimed is not limited to the description.

[0055] like Figure 1 , 2 As shown, an industrial image defect detection method includes the following steps:

[0056] S1. Obtain an image to be detected and load an industrial image defect detection model, wherein the industrial image defect detection model includes a plurality of teacher networks, a student network, a contrast loss function and a bidirectional feature mapping module;

[0057] The teacher network supports pre-trained CNN networks;

[0058] The student network supports custom CNN networks based on VGG16.

[0059] Before loading, building the industrial image defect detection model includes the following steps:

[0060] S10, build industrial image defect detection model;

[0061] The teacher network supports pre-trained CNN networks;

[0062] Use multiple different categories of teacher networks to extract image information from multiple angles, so as to train a student network with a complete knowledge system.

[0063] In this embodiment, two teacher networks are included, namely, the pre-trained CNN network ResNet34 and the pre-trained CNN network DenseNet168. Both the teacher networks ResNet34 and DenseNet168 include a convolution Conv1 and four convolution blocks Layer1, Layer2, Layer3, and Layer4. The shallow networks Conv1, Layer1, and Layer2 mainly focus on the edge and texture information of the target. As the network goes deeper, the deep networks Layer3 and Layer4 mainly focus on detail features, that is, semantic features, and improve the learning and expression capabilities of the network model through multiple layers of different feature information.

[0064] The student network supports custom CNN networks based on VGG16.

[0065] In this embodiment, the student network adopts a custom CNN network based on VGG16.

[0066] The principle of the custom CNN network architecture is as follows: it uses VGG16 as the encoder, and the decoder uses the last layer of global features of the VGG network. It upsamples layer by layer through the Resblock module and bilinear interpolation to help the model better utilize global context information. Finally, it uses jump connections to map low-resolution and high-resolution features, effectively integrating low-level and high-level features, which is conducive to the student network to generate discriminative features.

[0067] S20, obtaining an industrial image training set, and generating a synthetic abnormal image set according to the industrial image training set, wherein the images in the industrial image training set and the images to be detected are of the same type;

[0068] Generating a synthetic abnormal image set according to an industrial image training set specifically refers to: generating a synthetic abnormal image set according to an abnormal simulation strategy from an industrial image training set.

[0069] S30. Train the industrial image defect detection model by synthesizing an abnormal image set, construct a contrast loss function, and optimize the parameters of the industrial image defect detection model.

[0070] S30, training the industrial image defect detection model by synthesizing the abnormal image set, constructing the contrast loss function, and optimizing the parameters of the industrial image defect detection model include the following steps:

[0071] S301, selecting an image in the synthetic abnormal image set as a training image;

[0072] S302, input the training image into the industrial image defect detection model, obtain the multi-layer fusion features of the teacher network, and obtain the multi-layer features of the student network;

[0073] Obtaining the multi-layer fusion features of the teacher network includes the following steps:

[0074] Input the synthetic abnormal image into the teacher network to obtain the multi-layer features of the teacher network;

[0075] In this embodiment, the teacher network ResNet34 extracts the dimensions of 64 2 ×64, 32 2 ×128, 16 2 ×256, 8 2 ×512 4-layer features and defined as The teacher network DenseNet169 extracts dimensions of 64 2 ×64, 32 2 ×128, 16 2 ×512,8 2 ×1664 4-layer features and defined as Here l is uniformly set to 4, and the teacher network parameters are always kept frozen.

[0076] The multi-layer features of the teacher network are averaged between pixels according to the layers with the same corresponding resolution size to obtain multi-layer fusion features.

[0077] In this embodiment, the multi-layer features of multiple teacher networks are averaged pixel by pixel at the level with the same resolution to obtain a multi-layer fusion feature matrix The multi-layer fusion feature matrix here also includes 4 layers of features, corresponding to feature dimensions of 64 2 ×64, 32 2 ×128, 16 2 ×256, 8 2 ×512.

[0078] like Figure 3 As shown in the figure, the student network custom CNN network is mainly redesigned based on VGG16, the network parameters need to be optimized, and the output decoder dimension is also 64 2 ×128, 32 2 ×256, 16 2 ×512,8 2 ×512 4-layer features and defined as

[0079] S303, bidirectionally mapping the multi-layer fusion feature matrix of the teacher network and the multi-layer features of the student network through a bidirectional feature mapping module to obtain a mapped feature representation;

[0080] The bidirectional feature mapping module includes a teacher feature mapping submodule and a student feature mapping submodule;

[0081] Bidirectionally mapping the multi-layer fusion features of the teacher network and the multi-layer features of the student network through the bidirectional feature mapping module specifically refers to: unidirectionally mapping the multi-layer fusion features of the teacher network to the feature level of the student network through the teacher feature mapping submodule, unidirectionally mapping the multi-layer features of the student network to the feature level of the teacher network through the student feature mapping submodule, and then performing feature matching on the same feature level.

[0082] like Figure 4 As shown in FIG. 1 , the working principle of the bidirectional feature mapping module BFM is shown. BFM mainly consists of two parts: the teacher feature mapping submodule TFM and the student feature mapping submodule SFM.

[0083] Specifically, the structure of TFM and SFM is roughly the same, with a 1×1 convolution block at the front and back to increase the linear combination of information between channels of the input feature matrix and change the dimension. Two Resblock modules are stacked internally to increase the depth of BFM. Finally, the input feature matrix is ​​directly scaled by a 1×1 convolution block, and then added to the features after unidirectional mapping to obtain the final mapped feature representation. However, TFM adds a channel and space fusion attention mechanism CSAM module to focus on important spatial and channel feature information.

[0084] The mapping process expression of bidirectional mapping is as follows:

[0085]

[0086] Among them, l is the number of feature layers, The feature representation after the multi-layer feature fusion matrix mapping of the teacher network, is the feature representation after multi-layer feature mapping of the student network, TFM is the teacher feature mapping submodule, SFM is the student feature mapping submodule, is the multi-layer feature fusion matrix of the teacher network, For the multi-layer features of the student network, It is the one-way mapping network parameter of TFM. One-way mapping network parameters for SFM.

[0087] Among them, when training the industrial image defect detection model, Parameters need to be optimized.

[0088] S304, constructing a contrast loss function according to the multi-layer fusion features of the teacher network, the multi-layer features of the student network and the mapped feature representation;

[0089] S304, constructing a contrast loss function according to the multi-layer fusion features of the teacher network, the multi-layer features of the student network and the mapped feature representation includes the following steps:

[0090] Normalizing the multi-layer fusion features of the teacher network, the multi-layer features of the student network, and the mapped feature representation to obtain a normalized feature representation;

[0091] In this embodiment, the multi-layer fusion features of different teacher networks Multi-layer features extracted by the student network And the feature representation after mapping by the bidirectional feature mapping module Normalization is performed to obtain normalized feature representation

[0092] Constructing a normal pixel set and a synthetic abnormal pixel set based on the normalized feature representation;

[0093] In this embodiment, the normalized feature representation Construct their own normal pixel sets respectively and synthetic abnormal pixel set

[0094] Among them, m and k represent the number of normal pixels and the number of synthetic abnormal pixels, respectively.

[0095] Define the teacher domain and student domain;

[0096] The mapped feature representation includes: the feature representation after multi-layer fusion feature mapping of the teacher network and the feature representation after multi-layer feature mapping of the student network;

[0097] The teacher domain refers to the feature space composed of the multi-layer fusion features of the teacher network and the multi-layer feature mapping of the student network;

[0098] The student domain refers to the feature space composed of the multi-layer features of the student network and the multi-layer fusion feature mapping of the teacher network;

[0099] A distance function is defined according to the normal pixel set and the synthetic abnormal pixel set, wherein the distance function includes a distance function of a teacher domain and a distance function of a student domain;

[0100] Defining the distance function means: using Smoth L1loss to define the distance function between features in the same domain.

[0101] The expression of the distance function is as follows:

[0102]

[0103] Among them, S represents the Smoth L1loss function, p represents the pixel value, represents the distance value between normal features in the teacher domain, Represents the distance value between abnormal features in the teacher domain, Represents the distance value between normal features of the student domain, Represents the distance value between abnormal features in the student domain.

[0104] A contrastive loss function is constructed according to the distance function, wherein the contrastive loss function includes a loss function of a teacher domain and a loss function of a student domain.

[0105] The loss function of the teacher domain and the loss function of the student domain are expressed as follows:

[0106]

[0107] in, is the loss function of the teacher domain, is the loss function of the student domain, N is the batch size of each training, and λ n With λ a is a hyperparameter, represents the distance value between normal features in the teacher domain, Represents the distance value between abnormal features in the teacher domain, Represents the distance value between normal features of the student domain, Represents the distance value between abnormal features in the student domain.

[0108] like Figure 5 As shown in the figure, it is a schematic diagram of the contrast loss function, which reduces the distance between normal features while expanding the distance between abnormal features. The details are as follows:

[0109] Reduce the multi-layer feature fusion matrix of the teacher network through the loss function of the teacher domain Feature representation after multi-layer feature mapping with the student network The distance between normal features is increased, and the distance between abnormal features is enlarged;

[0110] Narrowing down the multi-layer features of the student network through the loss function of the student domain Feature representation after multi-layer feature fusion matrix mapping with the teacher network The distance between normal features is reduced, and the distance between abnormal features is enlarged.

[0111] S305, optimizing parameters of the industrial image defect detection model by contrast loss function;

[0112] S305, optimizing the parameters of the industrial image defect detection model by contrast loss function includes the following steps:

[0113] Construct the total loss function by comparing the loss functions;

[0114] The student network parameters and bidirectional feature mapping module parameters are optimized according to the total loss function.

[0115] The overall loss function expression is as follows:

[0116]

[0117] in, is the total loss function, is the loss function of the teacher domain, is the loss function of the student domain, l is the number of feature layers, and L is the total number of feature layers.

[0118] S306. Select an image that has not been selected in the synthetic abnormal image set as a training image, and repeat steps S302 to S305 until the performance of the industrial image defect detection model reaches the best.

[0119] Until the performance of the industrial image defect detection model reaches the best, the detection performance of the model is represented by the image-level AUROC value, and the positioning performance is represented by the pixel-level AUROC.

[0120] S2. Input the image to be detected into the industrial image defect detection model to obtain the detection result.

[0121] The present invention conducts experiments on MVTecAD, BTAD, and VisA public industrial image datasets. The experimental results are shown in Figure 6 As shown in the figure, the effectiveness and versatility of the industrial image defect detection method are verified. Among them, a is the detection effect on the MVTecAD industrial image dataset, b is the detection effect on the BTAD industrial image dataset, and c is the detection effect on the VisA industrial image dataset; normal image, abnormal image, ground truth, STPM defect detection and positioning heat map, and the defect detection and positioning heat map of the present invention are arranged from left to right.

[0122] As can be seen from the figure, the present invention realizes high-precision industrial image defect detection, and uses multiple teacher networks to train a student network. Multiple teacher networks can extract image information from multiple angles, so as to train a student network with a complete knowledge system, so that the industrial image defect detection model is more accurate and has stronger detection performance. The traditional student network adopts the same or similar network architecture as the teacher network, and redesigns the student network to improve its ability to express abnormal features; a bidirectional feature mapping module is added between the teacher and student networks to alleviate the huge difference between the model capabilities of the teacher and student networks, and the difference between the output features of the teacher and student networks is increased by comparing the loss function, thereby improving the reliability of industrial image defect detection.

Claims

1. An industrial image defect detection method, characterized in that: The following steps are involved: S1. Obtain an image to be detected and load an industrial image defect detection model, wherein the industrial image defect detection model includes a plurality of teacher networks, a student network, a contrast loss function and a bidirectional feature mapping module; S2. Input the image to be detected into the industrial image defect detection model to obtain the detection result.

2. The industrial image defect detection method according to claim 1, characterized in that: The teacher network supports pre-training CNN network; The student network supports a custom CNN network based on VGG16.

3. The industrial image defect detection method according to claim 1, characterized in that: Before loading, building an industrial image defect detection model includes the following steps: S10, build industrial image defect detection model; S20, obtaining an industrial image training set, and generating a synthetic abnormal image set according to the industrial image training set, wherein the images in the industrial image training set and the images to be detected are of the same type; S30. Train the industrial image defect detection model by synthesizing an abnormal image set, construct a contrast loss function, and optimize the parameters of the industrial image defect detection model.

4. The industrial image defect detection method according to claim 3, characterized in that: Generating a synthetic abnormal image set according to an industrial image training set specifically refers to: generating a synthetic abnormal image set according to an abnormal simulation strategy using an industrial image training set.

5. The industrial image defect detection method according to claim 3, characterized in that: The S30, training the industrial image defect detection model by synthesizing the abnormal image set, constructing the contrast loss function, and optimizing the parameters of the industrial image defect detection model includes the following steps: S301, selecting an image in the synthetic abnormal image set as a training image; S302, input the training image into the industrial image defect detection model, obtain the multi-layer fusion features of the teacher network, and obtain the multi-layer features of the student network; S303, bidirectionally mapping the multi-layer fusion feature matrix of the teacher network and the multi-layer features of the student network through a bidirectional feature mapping module to obtain a mapped feature representation; S304, constructing a contrast loss function according to the multi-layer fusion features of the teacher network, the multi-layer features of the student network and the mapped feature representation; S305, optimizing parameters of the industrial image defect detection model by contrast loss function; S306. Select an image that has not been selected in the synthetic abnormal image set as a training image, and repeat steps S302 to S305 until the performance of the industrial image defect detection model reaches the best.

6. The industrial image defect detection method according to claim 5, characterized in that: The method of obtaining the multi-layer fusion features of the teacher network includes the following steps: Input the synthetic abnormal image into the teacher network to obtain the multi-layer features of the teacher network; The multi-layer features of the teacher network are averaged between pixels according to the layers with the same corresponding resolution size to obtain multi-layer fusion features.

7. The industrial image defect detection method according to claim 5, characterized in that: The bidirectional feature mapping module includes a teacher feature mapping submodule and a student feature mapping submodule; The bidirectional mapping of the multi-layer fusion features of the teacher network and the multi-layer features of the student network through the bidirectional feature mapping module specifically refers to: unidirectionally mapping the multi-layer fusion features of the teacher network to the feature level of the student network through the teacher feature mapping submodule, unidirectionally mapping the multi-layer features of the student network to the feature level of the teacher network through the student feature mapping submodule, and then performing feature matching on the same feature level.

8. The industrial image defect detection method according to claim 5, characterized in that: The step S304, constructing a contrast loss function according to the multi-layer fusion features of the teacher network, the multi-layer features of the student network and the mapped feature representation, comprises the following steps: Normalizing the multi-layer fusion features of the teacher network, the multi-layer features of the student network, and the mapped feature representation to obtain a normalized feature representation; Constructing a normal pixel set and a synthetic abnormal pixel set based on the normalized feature representation; Define the teacher domain and student domain; A distance function is defined according to the normal pixel set and the synthetic abnormal pixel set, wherein the distance function includes a distance function of a teacher domain and a distance function of a student domain; A contrastive loss function is constructed according to the distance function, where the contrastive loss function includes a loss function of a teacher domain and a loss function of a student domain.

9. The industrial image defect detection method according to claim 8, characterized in that: The mapped feature representation includes: a feature representation after multi-layer fusion feature mapping of the teacher network and a feature representation after multi-layer feature mapping of the student network; The teacher domain refers to a feature space composed of multi-layer fusion features of the teacher network and multi-layer feature mapping of the student network; The student domain refers to a feature space composed of feature representations after multi-layer features of the student network and multi-layer fusion feature mapping of the teacher network; Defining the distance function refers to: using Smoth L1loss to define the distance function between features in the same domain.

10. The industrial image defect detection method according to claim 5, characterized in that: The S305, optimizing the parameters of the industrial image defect detection model by using the contrast loss function, comprises the following steps: Construct the total loss function by comparing the loss functions; Optimize the student network parameters and bidirectional feature mapping module parameters according to the total loss function; The detection performance of the model is represented by the image-level AUROC value until the performance of the industrial image defect detection model reaches the best, and the positioning performance is represented by the pixel-level AUROC value.

Citation Information

Cited By

  • Product defect detection method based on adaptive complementary channel and full-span enhancement

    CN120725981A