A defect detection method based on abnormal feature decomposition and texture-background conversion

Through the methods of abnormal feature decomposition and texture background conversion, and using technologies such as domain feature intersection module and latent space constraint module, the problem of low accuracy in texture surface defect detection is solved, and efficient detection of different types of texture surface defects is achieved.

CN115100119BActive Publication Date: 2024-09-10HUAZHONG UNIV OF SCI & TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210623977.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-02
Publication Date
2024-09-10
Estimated Expiration
2042-06-02

AI Technical Summary

Technical Problem

Existing texture surface defect detection methods are difficult to apply to different types of textures, and there are problems with low detection accuracy, especially on textured surfaces with large-scale changes, low contrast, irregular brightness changes, and variable shapes.

Method used

Using a defect detection method based on abnormal feature decomposition and texture background conversion, through the first domain feature intersection module and the second domain feature intersection module that are cascaded and share network parameters, pseudo-normal samples and pseudo-abnormal samples are extracted and generated, combined with the latent space Constraint module and adversarial segmentation module perform adversarial training to improve detection accuracy.

Benefits of technology

It significantly improves the accuracy of texture surface defect detection, reduces the over-inspection rate, and enhances the accuracy of texture background reconstruction, and is suitable for the detection of various texture surface defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115100119B
    Figure CN115100119B
Patent Text Reader

Abstract

The present invention belongs to the field of image processing, and discloses a defect detection method based on abnormal feature decomposition and texture background conversion. The method includes a random splicing module, a domain feature intersection module, an adversarial segmentation module and a latent space constraint module. The random splicing module is used for the random generation of artificial abnormal samples; the domain feature intersection module decomposes background features and defect features, and implicitly converts background features to complete feature separation; the latent space constraint module further constrains the background features of the normal domain and the abnormal domain in a common space; the pixel-level adversarial segmentation module further improves the texture reconstruction accuracy through a pixel-level adversarial learning mechanism, and can also directly segment the defect position. When performing detection, on the one hand, the defect area is indirectly determined by subtracting the input image from the reconstructed texture background image, and on the other hand, the defect is directly segmented in the defect map. In this way, the present invention has a high detection accuracy for defects of different sizes and different contrasts on different texture surfaces.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image processing, and more specifically, relates to a defect detection method based on abnormal feature decomposition and texture-background conversion. Background Art

[0002] In the field of industrial manufacturing, the quality of raw materials varies, the manufacturing process is complex, and surface defects often occur on the surface of products, such as steel, wood, textiles, tiles and new display devices such as TFT-LCD, OLED, etc. Since the surfaces of various products often show texture characteristics, surface defects refer to local areas that are different from the surrounding texture structure and pattern, or local areas with irregular brightness changes. These texture surface defects will directly reduce product quality and affect user experience. In order to improve production quality, all types of surface defects should be strictly controlled during the manufacturing process, so texture surface defect detection is the foundation and key of the entire manufacturing industry.

[0003] In the manufacturing process of various industrial products, texture surface defects have the following characteristics: different types, large scale changes, low contrast, irregular brightness changes, and variable shapes. At the same time, the number of defective products is very small compared to good products, resulting in a small number of available abnormal samples, which brings great difficulties to visual inspection. Therefore, texture surface defect detection methods are still a challenging task in industrial product quality control.

[0004] At present, many methods have been proposed to solve the problem of texture surface defect detection, but these research results can only be applied to a certain type or several types of textures (such as only being able to detect display devices, not applicable to wood surfaces), and can only detect fixed types of texture defects (such as only being able to detect high-contrast defects, not low-area defects), and it is difficult to solve all situations. Therefore, it is necessary to propose a texture surface defect detection method based on unsupervised deep learning, which can be applied to various types of textures and has good robustness to different types of texture surface defects. Summary of the invention

[0005] In view of the above defects or improvement needs of the prior art, the present invention provides a defect detection method based on abnormal feature decomposition and texture background conversion, which aims to use the powerful data modeling ability of deep learning to detect surface defects of industrial products, thereby solving the problem of low detection accuracy caused by different types, large-scale changes, extremely low contrast, irregular brightness changes, variable shapes and lack of samples in the texture surface defect detection method. The detection accuracy can be greatly improved.

[0006] To achieve the above objectives, in a first aspect, the present invention provides a method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion, comprising:

[0007] S1. Build a defect detection model; the defect detection model includes: a first domain feature cross module and a second domain feature cross module that are cascaded and share network parameters;

[0008] The first domain feature crossover module is used to extract the first normal domain background feature of the input normal sample and extract the first abnormal domain background feature and the first abnormal domain defect feature of the input abnormal sample; then generate a first pseudo normal sample based on the first abnormal domain background feature and generate a first pseudo abnormal sample based on the first normal domain background feature and the first abnormal domain defect feature;

[0009] The second domain feature crossover module is used to extract the second normal domain background feature of the first pseudo normal sample and extract the second abnormal domain background feature and the second abnormal domain defect feature of the first pseudo abnormal sample; and then generate a second pseudo normal sample based on the second abnormal domain background feature and generate a second pseudo abnormal sample based on the second normal domain background feature and the second abnormal domain defect feature;

[0010] S2. Training the defect detection model with the goal of minimizing the difference between the residual between the first pseudo normal sample and the input abnormal sample, and the residual between the first pseudo abnormal sample and the input normal sample, and minimizing the difference between the residual between the second pseudo normal sample and the input normal sample, and the residual between the second pseudo abnormal sample and the input abnormal sample.

[0011] Furthermore, the first domain feature cross-module includes:

[0012] A first normal domain background encoder, used to encode an input normal sample into a first normal domain background feature; a first abnormal domain background encoder, used to encode an input abnormal sample into a first abnormal domain background feature; a first abnormal domain defect encoder, used to encode an input abnormal sample into a first abnormal domain defect feature; a first normal domain generator, used to generate a first pseudo normal sample based on the first abnormal domain background feature; a first abnormal domain generator, used to generate a first pseudo abnormal sample based on the first normal domain background feature and the first abnormal domain defect feature;

[0013] The second domain feature cross-module comprises:

[0014] The second normal domain background encoder is used to encode the first pseudo-normal sample into the second normal domain background feature; the second abnormal domain background encoder is used to encode the first pseudo-abnormal sample into the second abnormal domain background feature; the second abnormal domain defect encoder is used to encode the first pseudo-abnormal sample into the second abnormal domain defect feature; the second normal domain generator generates the second pseudo-normal sample based on the second abnormal domain background feature; the second abnormal domain generator generates the second pseudo-abnormal sample based on the second normal domain background feature and the second abnormal domain defect feature.

[0015] Furthermore, the loss function also includes: minimizing the difference between the input normal sample and the normal reconstructed image, and minimizing the sum of the differences between the input abnormal sample and the abnormal reconstructed image; wherein, the normal reconstructed image is an image reconstructed by the first normal domain background feature through the first normal domain generator, and the abnormal reconstructed image is an image reconstructed by the first abnormal domain background feature and the first abnormal domain defect feature through the first abnormal domain generator.

[0016] Furthermore, the defect detection model also includes a latent space constraint module, which is used to constrain the first normal domain background features and the first abnormal domain background features to share the same latent space, so that the discriminator cannot distinguish between the first normal domain background features and the first abnormal domain background features.

[0017] Furthermore, the defect detection model also includes a random splicing module for generating abnormal samples, specifically: cutting out an area corresponding to the mask in a normal sample as a simulated defect; and then splicing it with another normal sample to obtain an abnormal sample.

[0018] Furthermore, the defect detection model also includes an adversarial segmentation module, which is used to segment the input texture image to obtain a defect segmentation result;

[0019] The method further includes: performing adversarial training using the input abnormal sample as a positive sample and the first pseudo normal sample and the first pseudo abnormal sample as negative samples.

[0020] In a second aspect, the present invention provides a defect detection method based on abnormal feature decomposition and texture background conversion, comprising:

[0021] The texture image to be tested is input into the defect detection model constructed by the method for constructing a defect detection model based on abnormal feature decomposition and texture background conversion described in the first aspect, to obtain the first pseudo normal sample, and the residual image between the texture image to be tested and the first pseudo normal sample is used as the final detection result.

[0022] In a third aspect, the present invention provides a defect detection method based on abnormal feature decomposition and texture background conversion, comprising:

[0023] The texture image to be tested is input into the defect detection model constructed by the method for constructing a defect detection model based on abnormal feature decomposition and texture background conversion described in the first aspect, and the first pseudo-normal sample output by the first domain feature intersection module and the defect segmentation result output by the adversarial segmentation module are obtained. The residual between the texture image to be tested and the first pseudo-normal sample is fused with the defect segmentation result to obtain the final detection result.

[0024] In a fourth aspect, the present invention provides a computer-readable storage medium, comprising a stored computer program, wherein when the computer program is executed by a processor, the device where the storage medium is located is controlled to execute the method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion as described in the first aspect and / or the defect detection method based on abnormal feature decomposition and texture-background conversion as described in the second aspect or the third aspect.

[0025] In general, the above algorithm conceived by the present invention can achieve the following beneficial effects compared with the existing algorithms:

[0026] 1. The present invention uses a domain feature cross module to perform two decomposition and transformation on the image, implicitly realizes feature decomposition and transformation, increases the difference between defects and texture background to a certain extent, and improves the defect detection rate.

[0027] 2. The present invention uses a latent space constraint module to constrain the distribution of normal domain and abnormal domain latent space background features in the common space, thereby ensuring the stability of training in the early stage of training and improving the accuracy of network feature decomposition, which can further improve the texture defect detection rate while reducing the over-detection rate.

[0028] 3. The present invention adopts an adversarial segmentation module to further improve the accuracy of texture background reconstruction through adversarial learning, which can effectively suppress defects from being reconstructed into the texture background, thereby improving the defect detection rate and reducing the defect over-detection rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 This is one of the flow charts of a method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion provided by an embodiment of the present invention;

[0030] Figure 2 This is the second flow chart of the method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion provided by an embodiment of the present invention;

[0031] Figure 3 is a schematic diagram of an adversarial segmentation module provided by an embodiment of the present invention;

[0032] Figure 4 is a schematic diagram of a latent space constraint module provided by an embodiment of the present invention;

[0033] Figure 5 is a schematic diagram of a test phase provided by an embodiment of the present invention;

[0034] Figure 6 It is a schematic diagram of the defect detection effect provided by an embodiment of the present invention, wherein the first line is a test set sample image, the second line is a detection result, and the third line is a label image of the test set sample image. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0036] Example 1

[0037] See also Figure 1 , combined with Figures 2 to 5 The present invention proposes a method for constructing a defect detection model based on abnormal feature decomposition and texture background conversion, comprising:

[0038] S1. Build a defect detection model; the defect detection model includes: a first domain feature cross module and a second domain feature cross module that are cascaded and share network parameters;

[0039] The first domain feature crossover module is used to extract the first normal domain background feature of the input normal sample and extract the first abnormal domain background feature and the first abnormal domain defect feature of the input abnormal sample; then generate a first pseudo normal sample based on the first abnormal domain background feature and generate a first pseudo abnormal sample based on the first normal domain background feature and the first abnormal domain defect feature;

[0040] The second domain feature crossover module is used to extract the second normal domain background feature of the first pseudo normal sample and extract the second abnormal domain background feature and the second abnormal domain defect feature of the first pseudo abnormal sample; and then generate a second pseudo normal sample based on the second abnormal domain background feature and generate a second pseudo abnormal sample based on the second normal domain background feature and the second abnormal domain defect feature;

[0041] S2. Training the defect detection model with the goal of minimizing the difference between the residual between the first pseudo normal sample and the input abnormal sample, and the residual between the first pseudo abnormal sample and the input normal sample, and minimizing the difference between the residual between the second pseudo normal sample and the input normal sample, and the residual between the second pseudo abnormal sample and the input abnormal sample.

[0042] In this embodiment, Figure 2As shown in the figure, the defect detection model includes a random splicing module RCM, a domain feature cross module DFCM, an adversarial segmentation module ASM and a latent space constraint module LCM. First, the random splicing module is used to randomly generate artificial abnormal samples; secondly, the domain feature cross module decomposes the background features and defect features, and implicitly transforms the background features to complete feature separation; in the latent space constraint module, an adversarial learning method is proposed to further constrain the background features of the normal domain and the abnormal domain in the common space; finally, the pixel-level adversarial segmentation module uses the pixel-level adversarial learning mechanism to further improve the texture reconstruction accuracy through adversarial learning, and can also directly segment the defect position. During the detection, on the one hand, the input image and the reconstructed texture background image are subtracted to indirectly determine the defect area, and on the other hand, the defect is directly segmented in the defect map. The following is a detailed description of each module.

[0043] (1) Random splicing module

[0044] like Figure 2 As shown in Figure 2, real abnormal samples are simulated by artificial synthesis. The generation of artificial abnormal samples can be described as:

[0045] I a (x,y)=(1-I m (x,y))·I t1 (x,y)+I m (x,y)·f T (I t2 (x,y)

[0046] Among them, I a ,I m ,I t1 ,I t2 ∈R W×H×1 , W×H represent the width and height of the image respectively. This embodiment is performed on a grayscale image, which is set to a single channel with 256 pixels, x=1,...,W, y=1,...,H. t1 ,I t2 Represents two randomly selected normal samples, I m represents a pre-randomly generated mask image. T (·) represents a random transformation function.

[0047] Usually, texture surface defects will appear as adhesion defects similar to grayscale changes and structural defects similar to affine transformations. In order to truly simulate various types of defects, f T (·) represents grayscale transformation, scale transformation, and rotation transformation, as shown in the following formula:

[0048] f T1 (I t2 (x,y))=λ1·I t2 (x,y)

[0049] f T2 (I t2 (x,y))=I t2 (λ2x,λ2y)

[0050] f T3 (I t2 (x,y))=I t2 (x′,y′)

[0051] Among them, λ1∈[0.4,0.8)∪[1.3,1.5) represents the random influence factor during grayscale transformation, λ2∈[0.5,0.8)∪[1.2,1.6) represents the random influence factor during scale transformation, and (x′,y′) represents the new coordinates after rotation transformation, which can be obtained by the following formula:

[0052]

[0053] Among them, θ∈[10°,60°) represents a random angle rotation of the original image. Since the selection of various transformations and mask images during training is random, the number of real defects that can be simulated is greatly expanded, and the data is greatly enhanced by using real images. Therefore, in the absence of real abnormal samples, through this process, RCM can still complete the generation of a large number of simulation samples close to real defects.

[0054] (2) Domain feature cross-module

[0055] like Figure 2 As shown, the domain feature cross module is used for implicit feature separation and background feature conversion, including a normal domain background encoder, an abnormal domain background encoder, an abnormal domain defect encoder, a normal domain generator and an abnormal domain generator. In this embodiment, each encoder performs feature encoding on the corresponding image respectively, and the encoder extracts the latent space convolution feature, which consists of 4 convolution layers, each of which has a convolution kernel of 3x3 and a step size of 2. The number of filter kernels in the first layer is 32, and the number of subsequent convolution kernels increases in multiples of 2. Each generator generates a false image in the corresponding data domain, which includes 4 transposed convolution layers, each of which has a convolution kernel of 3x3 and a step size of 2. The number of filter kernels in the first layer is 256, and the number of subsequent convolution kernels decreases in multiples of 2. The domain feature cross module takes the paired images generated by the random splicing module as input, decomposes and transforms the image twice, and implicitly realizes feature decomposition and conversion.

[0056] Artificial abnormal sample I can be obtained in RCM a and the paired normal sample I n In the first stage of DFCM (DFCM-one), the normal domain background encoder is obtained by the prior assumption The normal sample I n Encoded as normal domain background features Abnormal Domain Background Encoder Abnormal Domain Defect Encoder Encode abnormal samples into abnormal domain background features respectively and abnormal domain defect characteristics Complete the latent space feature embedding as shown below:

[0057]

[0058]

[0059]

[0060] in and Represent the neural network function of each encoder and its network parameter matrix respectively.

[0061] Since defects usually manifest as changes or structural damage on the defect-free surface, the present invention assumes that all samples, including normal samples and abnormal samples, should show consistency in the distribution space of background features. The background features of the abnormal domain are always coupled with some defect features, but their distribution in the latent space will be close to the background features of the normal domain. The key to the present invention to achieve defect detection is to understand and express the two types of background features through neural networks and complete mutual conversion. Therefore, the background latent space features of normal samples and the latent space features of abnormal samples should be converted, and the feature cross-generation process can be expressed as follows:

[0062]

[0063]

[0064] Among them, I n1 ,I a1 ∈R W×H×1 , W×H represent the width and height of the image, which are set to 256. and Respectively represent each generator neural network function and its network parameter matrix. After the abnormal sample and the background features of the normal sample are crossed and reconstructed, the generation of the first pseudo normal sample and the first pseudo abnormal sample is completed.

[0065] In addition, the AE of the encoder-decoder structure should also learn the ability to reconstruct itself. The background encoder and defect encoder set in the present invention need to learn the flow distribution of the corresponding features in the latent space respectively. The most direct way is to learn the image self-reconstruction, that is, the feature combination without cross conversion can reconstruct the input image, as shown in the following formula:

[0066]

[0067]

[0068] Among them I nr ,I ar ∈R W×H×1 represents the self-reconstructed image without feature crossover, W×H represents the width and height of the image, which are set to 256.

[0069] At the beginning of training, the network parameters are random, and the latent space feature expression has not yet been learned. The generated results after feature crossover are difficult to converge. Convolutional autoencoder AE has the characteristic of fast convergence. Therefore, using non-crossed features to complete self-reconstruction can ensure the normal progress of training at the beginning of training, which is crucial to accelerate network convergence and achieve separation of background features and defect features. The features used to generate images all come from the results of encoding the input image itself, so for these two images, the self-reconstruction loss function is designed as shown in the following formula:

[0070]

[0071] in, represents expectation, and ||·||2 represents the L2 norm.

[0072] Numerous works in the field of defect detection based on deep learning have shown that when the defect position is expressed in latent space features, the coupling between different features is the tightest. In order to further ensure the reconstruction quality of the defect area and make the network pay more attention to the feature expression of the defect, the present invention targets the first pseudo normal sample I n1 , the first pseudo abnormal sample I a1 The design defect reconstruction loss is shown in the following formula:

[0073]

[0074] Where D represents the expected distribution of defect characteristics, I res1 =|I n1 -I a | and I res2 =|I a1 -I n |represent the residuals of the defective area respectively.

[0075] Implicit feature separation cannot be completed by only one stage of DFCM. Through the above process, the first pseudo normal sample I n1 , the first pseudo abnormal sample I a1Feature separation cannot be guaranteed, that is, it is impossible to determine whether the exchange of background features can be trained correctly and stably. At the same time, the constraints in DFCM-one still make it difficult for the network to learn feature expressions in two data domains. Therefore, DFCM is connected in series again after DFCM-one as the second stage of DFCM (DFCM-two) to ensure that the network completes cycle consistency learning.

[0076] DFCM-two and DFCM-one share complete parameters, so the CNN sub-model G n and G a The labels of continue to be used without distinction. The first pseudo normal sample I n1 , the first pseudo abnormal sample I a1 As the input of DFCM-two, I n1 Encoded Perform feature encoding, I a1 Encoded and Perform feature encoding as shown below:

[0077]

[0078]

[0079]

[0080] in, Respectively represent the second latent space encoding vector of the corresponding image. The present invention is based on the assumption that background features are distributed in the same latent space and features of different data domains can be separated independently. Referring to the process of DFCM-one feature decomposition, Background characteristics and should have the same distribution, Background characteristics and should have the same distribution.

[0081] The latent space encoding of the abnormal domain consists of two types of latent space feature encodings. Therefore, the feature crossover of the abnormal domain first performs a feature fusion operation, as shown in the following formula:

[0082]

[0083] Among them, concat[·] represents the concatenation operation along the channel direction. m (·) indicates a convolution operation with a kernel size of 1×1 and a stride of 1, which is used for feature dimensionality reduction.

[0084] Under the feature separable assumption, Should meet the normal sample I nThe distribution in the latent space is similar to z a2 With abnormal sample I a The distribution in the latent space is consistent. Therefore, the generators of the normal domain and the abnormal domain can completely reconstruct the original input image, as shown in the following formula:

[0085]

[0086]

[0087] Among them, z a2 is the fusion feature vector. n2 ,I a2 ∈R W×H×1 These are the pseudo normal samples and pseudo abnormal samples generated by the second crossover. W×H represents the width and height of the image, respectively, and is set to 256.

[0088] Since the self-reconstruction loss and defect area reconstruction loss have been added in DFCM-one, DFCM-two does not impose any additional constraints to reduce the training complexity of the network. n2 The latent space features are completely derived from I n , and used to generate the second pseudo abnormal sample I a2 The latent space features are completely derived from I a Therefore, the present invention designs a cycle consistency loss to further constrain the realization of feature separation and conversion, as shown in the following formula:

[0089]

[0090] in, and Represents the processing of DFCM-one, i.e., the fake image generated by the first cross.

[0091] The overall loss function of the DFCM module is as follows:

[0092] L r =λ sr L sr +λ dr L dr +λ cc L cc

[0093] Among them, λ sr ,λ dr ,λ cc They are the weights of three losses. To balance the impact of each loss during training, this paper sets: sr =1,λ dr = 0.1 and λ cc= 1. Through reconstruction loss constraints and latent space feature learning at different stages, DFCM can decompose background features and defect features, completing accurate background reconstruction while suppressing defects.

[0094] The ADTAN network aims to learn the ability of feature decomposition and conversion. The two-stage DFCM performs cyclic encoding-decoding operations on the input image through implicit modeling, and guides the network to learn feature encoding information in the latent space through global cyclic consistency constraints and local reconstruction constraints. DFCM converts the background features of the abnormal domain to the normal domain, decouples the background features, and realizes the precise separation of the features of various texture surface defects such as mura defects in the latent space, reconstructs a good texture background, and suppresses the abnormal area.

[0095] (3) Adversarial Segmentation Module

[0096] The convolutional autoencoder cannot accurately express the details of the reconstructed image, and the details of the generated reconstructed image are not realistic enough. The transition between the boundary of the artificial defect and the real background is not natural enough. Therefore, the ADTAN algorithm proposes an adversarial segmentation module ASM to improve the reconstruction quality. Through adversarial learning, the network improves the image reconstruction quality in the game. At the same time, the pixel-level segmentation discriminator also has the ability to accurately segment defects.

[0097] In this embodiment, the pixel-level adversarial segmentation module is used to further improve the texture background reconstruction accuracy through adversarial learning. Figure 3 As shown in the figure, it consists of 4 convolutional layers and 4 transposed convolutional layers. The convolution kernel of each convolutional layer is 3x3, the step size is 2, the number of filter kernels in the first layer is 32, and the number of subsequent convolution kernels increases by multiples of 2. The convolution kernel of each transposed convolutional layer is 3x3, the step size is 2, the number of filter kernels in the first layer is 256, and the number of subsequent convolution kernels decreases by multiples of 2. The pixel-level adversarial segmentation module takes the fake image generated by the domain feature cross module for the first time as input, and judges the authenticity of the generated image with pixel accuracy. Through the pixel-level adversarial learning mechanism, the texture reconstruction accuracy is further improved, and then the defect detection accuracy is further improved.

[0098] According to the DFCM-one process, I n1 and I a1 It is the result of the first feature cross conversion. Since the simple encoding-decoding result cannot guarantee good reconstruction quality, the present invention proposes a novel adversarial learning mechanism for this result.

[0099] Generator G of two data domains in DFCM n and G aIt is necessary to improve the realism of the reconstructed image. Therefore, the present invention defines an Adversarial Segmentation Discriminator (D seg ) to conduct game training with the generator.

[0100] I n1 and I a1 As the generated image, it is sent to ASM as a pseudo image with a negative label, and the original input image I a As a real sample, its label is positive. The process of adversarial training is as follows: on the one hand, the generator G n and G a The generated samples try their best to deceive the discriminator D seg On the other hand, the discriminator D seg It needs to continuously improve its ability to accurately distinguish between positive and negative samples. In the constant game between the two, the quality of the images generated by the generator will gradually improve.

[0101] The adversarial segmentation learning process can be represented by the pixel-wise cross entropy loss function as shown below:

[0102]

[0103]

[0104] in, ⊙ and ||·||1 represent expectation, dot product and L1 norm respectively. n1_s , I a1_s and I a_s is the segmentation discriminator D seg The result is shown in the following formula:

[0105]

[0106]

[0107]

[0108] The discriminator receives more abnormal sample inputs than normal samples, so the loss weight coefficient λ of the training discriminator is dis It is set to 0.5 to balance the training imbalance problem that may be caused by uneven input samples.

[0109] Pixel-by-pixel discrimination requires the ability to accurately discern details, which means that more accurate segmentation results can be obtained. segThe pixel-level discriminator is designed as a U-net structure, and the convolution kernels of the full convolution structure are all set to 3×3. In order to reduce the complexity of the network and increase the reasoning speed, the jump connection in the U-net is designed to have only three layers, which can achieve a balance between efficiency and accuracy.

[0110] Since the network design uses RCM as a data augmentation module, the label image corresponding to the training image, that is, the mask image when generating artificial abnormal samples, can be directly obtained. Therefore, the adversarial segmentation learning mechanism proposed by ASM is concise and efficient in network training. seg ,ASM can not only greatly improve the quality of reconstruction in terms of details, but also directly extract the abnormal samples from the end-to-end a Segment defects accurately.

[0111] (4) Latent Space Constraint Module

[0112] like Figure 4 As shown, LCM consists of a hidden discriminator D l Composition, D l The design is composed of five convolution modules, each of which consists of a convolution layer, a batch normalization layer, and a RELU activation layer in series. l Aims to analyze the background features of normal domain and abnormal domain and On the other hand, the encoder used to encode the feature hopes to deceive D l , making it impossible to distinguish the latent space features of the encoding and

[0113] In this embodiment, the latent space constraint module is used to constrain the normal domain and abnormal domain latent space background features to be distributed in the common space. It consists of 5 convolutional layers. The convolution kernels of the first three convolutional layers are 7x7, the step size is 2, and the number of filter kernels of these three layers is 64. The convolution kernel of the fourth convolutional layer is 5x5, the step size is 1, and the number of filter kernels is 64. The convolution kernel of the last convolutional layer is 1x1, the step size is 1, and the number of filter kernels is 1. The latent space constraint module takes the normal domain background features and the abnormal domain background features in the latent space as input, and restricts the distribution of features in the common latent space through adversarial learning, so as to ensure the stability of training in the early stage of training and improve the accuracy of network feature decomposition.

[0114] The adversarial learning process is as follows:

[0115]

[0116] in represents the expected distribution of background features, and express and The discriminant vector of is obtained by the following formula:

[0117]

[0118]

[0119] LCM constrains latent space background features and Distributed in a new common latent space instead of constraining the background features of the abnormal domain Close to normal domain background features in latent space Normal domain background features It is difficult to ensure the desired latent space distribution in the early stage of training, which will lead to a contradiction with the feature separability assumption. l This conflict situation can be avoided through the adversarial learning mechanism proposed in this study.

[0120] Latent Space Discriminator D l Need to accurately distinguish the normal domain background features and abnormal domain background characteristics But it is not important for the given label to be correct. In this invention, for the convenience of explanation, the normal domain background features The label of is set to positive. On the other hand, when training the corresponding encoder and , its encoded latent space features should be difficult to distinguish, rather than being misjudged as positive or negative. Therefore, when training the encoder, the latent space feature discriminant vector and The label of is “half-positive”. Different from the general adversarial model, the “half-positive” label is designed to mix the two types of background features, so there is no need to accurately distinguish the positive and negative nature of the features.

[0121] Through LCM, ADTAN learns the ability to mix the background features of normal domain and abnormal domain. and Sharing the same latent space, defect characteristics The network can be separated at the same time. The ability of LCM to constrain feature distribution in the early stage alleviates the problem of GAN being difficult to train; at the same time, LCM ensures the feasibility of feature separation in the early stage of training, greatly improving the quality of reconstructed and generated images.

[0122] Example 2

[0123] like Figure 5 As shown, only the abnormal domain background encoder is used in the test phase Normal domain generator G n and adversarial segmentation discriminator D seg Accurate defect detection can be achieved. The background encoder obtained through training The test image I d Decomposed into texture background features, and then passed through the generator G n Generate defect-free texture background reconstruction image At the same time, the defect image I d Through the discriminator D seg Directly obtain defect segmentation image Will I d and The residual image and segmentation result Fusion can obtain fusion detection result I f , as shown below:

[0124]

[0125] Among them, I f ∈R W×H , 0<λ f ≤1 is the fusion coefficient of the two detection results. |·| is the pixel-by-pixel absolute value operation.

[0126] Finally, the fusion detection result I f Median filtering is performed to remove noise, and morphological closing operation is performed after threshold segmentation to obtain the final detection result. Since the overall parameter volume of an encoder-decoder structure is small, and the residual image and segmentation image ADTAN can be obtained in parallel and is very efficient during testing. By adjusting the fusion weights of the residual image and the segmented image, ADTAN can be applied to various texture backgrounds including mura defects. Figure 6 shown.

[0127] Example 3

[0128] A computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein when the computer program is executed by a processor, the device where the storage medium is located is controlled to execute the method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion as described in Example 1 and / or the defect detection method based on abnormal feature decomposition and texture-background conversion as described in Example 2.

[0129] The relevant technical means are the same as those in Example 1 and Example 2 and will not be described in detail here.

[0130] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion, characterized in that: include: S1. Build a defect detection model; The defect detection model includes: a first domain feature cross module and a second domain feature cross module which are cascaded and share network parameters; The first domain feature crossover module is used to extract the first normal domain background feature of the input normal sample and extract the first abnormal domain background feature and the first abnormal domain defect feature of the input abnormal sample; then generate a first pseudo normal sample based on the first abnormal domain background feature and generate a first pseudo abnormal sample based on the first normal domain background feature and the first abnormal domain defect feature; The second domain feature crossover module is used to extract the second normal domain background feature of the first pseudo normal sample and extract the second abnormal domain background feature and the second abnormal domain defect feature of the first pseudo abnormal sample; and then generate a second pseudo normal sample based on the second abnormal domain background feature and generate a second pseudo abnormal sample based on the second normal domain background feature and the second abnormal domain defect feature; S2. Training the defect detection model with the goal of minimizing the difference between the residual between the first pseudo normal sample and the input abnormal sample, and the residual between the first pseudo abnormal sample and the input normal sample, and minimizing the difference between the residual between the second pseudo normal sample and the input normal sample, and the residual between the second pseudo abnormal sample and the input abnormal sample.

2. The method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion according to claim 1 is characterized in that: The first domain feature cross-module comprises: A first normal domain background encoder, used to encode an input normal sample into a first normal domain background feature; a first abnormal domain background encoder, used to encode an input abnormal sample into a first abnormal domain background feature; a first abnormal domain defect encoder, used to encode an input abnormal sample into a first abnormal domain defect feature; a first normal domain generator, used to generate a first pseudo normal sample based on the first abnormal domain background feature; a first abnormal domain generator, used to generate a first pseudo abnormal sample based on the first normal domain background feature and the first abnormal domain defect feature; The second domain feature cross-module includes: The second normal domain background encoder is used to encode the first pseudo-normal sample into the second normal domain background feature; the second abnormal domain background encoder is used to encode the first pseudo-abnormal sample into the second abnormal domain background feature; the second abnormal domain defect encoder is used to encode the first pseudo-abnormal sample into the second abnormal domain defect feature; the second normal domain generator generates the second pseudo-normal sample based on the second abnormal domain background feature; the second abnormal domain generator generates the second pseudo-abnormal sample based on the second normal domain background feature and the second abnormal domain defect feature.

3. The method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion according to claim 2 is characterized in that: The loss function also includes: minimizing the difference between the input normal sample and the normal reconstructed image, and minimizing the sum of the differences between the input abnormal sample and the abnormal reconstructed image; wherein, the normal reconstructed image is an image reconstructed by the first normal domain background feature through the first normal domain generator, and the abnormal reconstructed image is an image reconstructed by the first abnormal domain background feature and the first abnormal domain defect feature through the first abnormal domain generator.

4. The method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion according to any one of claims 1 to 3, characterized in that: The defect detection model also includes a latent space constraint module, which is used to constrain the first normal domain background features and the first abnormal domain background features to share the same latent space, so that the discriminator cannot distinguish between the first normal domain background features and the first abnormal domain background features.

5. The method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion according to any one of claims 1 to 3, characterized in that: The defect detection model also includes a random splicing module for generating abnormal samples, specifically: cutting out an area corresponding to the mask in a normal sample as a simulated defect; and then splicing it with another normal sample to obtain an abnormal sample.

6. The method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion according to any one of claims 1 to 3, characterized in that: The defect detection model also includes an adversarial segmentation module, which is used to segment the input texture image to obtain a defect segmentation result; The method further includes: performing adversarial training using the input abnormal sample as a positive sample and the first pseudo normal sample and the first pseudo abnormal sample as negative samples.

7. A defect detection method based on abnormal feature decomposition and texture background conversion, characterized in that: include: The texture image to be tested is input into the defect detection model constructed by the method for constructing a defect detection model based on abnormal feature decomposition and texture background conversion as described in any one of claims 1 to 5, to obtain the first pseudo normal sample, and the residual image between the texture image to be tested and the first pseudo normal sample is used as the final detection result.

8. A defect detection method based on abnormal feature decomposition and texture-background conversion, characterized in that: include: The texture image to be tested is input into the defect detection model constructed by the method for constructing a defect detection model based on abnormal feature decomposition and texture background conversion as described in claim 6, and the first pseudo-normal sample output by the first domain feature intersection module and the defect segmentation result output by the adversarial segmentation module are obtained. The residual between the texture image to be tested and the first pseudo-normal sample is fused with the defect segmentation result to obtain the final detection result.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed by a processor, the device where the storage medium is located is controlled to execute the method for constructing a defect detection model based on abnormal feature decomposition and texture-background conversion as described in any one of claims 1 to 6 and / or the defect detection method based on abnormal feature decomposition and texture-background conversion as described in claim 7 or 8.

Citation Information

Patent Citations

  • Moving object detection method based on joint learning of low-rank decomposition and low-rank representation

    CN108764177A

  • Texture surface defect detection method and system based on abnormal synthesis and decomposition

    CN112700432A

  • Non-woven fabric flaw detection and classification method and system based on machine vision

    CN113554080A

  • Apparatus and method for image seperation using rank prior

    KR101556603B1