A cloth defect detection method and system

Through lightweight generative adversarial networks and morphological methods, the problem of low computational efficiency in cloth defect detection is solved, efficient and accurate detection is achieved, and it is suitable for embedded platforms and improves detection speed and accuracy.

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

Patent Information

Application Number
CN202210194370.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-01
Publication Date
2024-09-10
Estimated Expiration
2042-03-01

AI Technical Summary

Technical Problem

Existing technology cannot accurately detect cloth defects with high computational efficiency, especially when the number of defect samples is scarce and the hardware platform requirements are high.

Method used

A lightweight generative adversarial network is used to reconstruct the cloth sample to be tested through the pre-trained generator and discriminator, and the generative loss function and the discriminant loss function are used for training, and the morphological method is combined to detect defects, using unsupervised learning and randomization Noise enhanced reconstruction capabilities.

Benefits of technology

It achieves accurate detection of cloth defects at low computing cost and high efficiency, improves detection speed and accuracy, is suitable for embedded platforms, and can effectively deal with the problem of sparse and unbalanced defect samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114723660B
    Figure CN114723660B
Patent Text Reader

Abstract

The invention discloses a cloth defect detection method and system, which belongs to the field of computer vision, and comprises: S1, inputting a cloth sample to be tested into a pre-trained lightweight generative adversarial network to obtain a reconstructed image of the cloth sample to be tested; S2, comparing the difference between the cloth sample to be tested and its reconstructed image to detect the cloth defect; wherein, the lightweight generator comprises an encoder and a decoder; feature maps with equal length and width obtained in the encoder and the decoder are spliced ​​in a jump connection manner respectively; the encoder comprises a series of convolutional layers and a bottleneck module; the bottleneck module comprises a plurality of bottleneck layers which are sequentially connected in series from large to small in size; the bottleneck layer comprises a series of standard convolutional layers, a depth convolutional layer, a channel attention module and a point convolutional layer; the decoder also comprises the above-mentioned bottleneck layer, and the bottleneck layer in the decoder is mirror-symmetric with the bottleneck layer in the encoder; the invention can accurately perform cloth defect detection with high computational efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer vision, and more specifically, relates to a cloth defect detection method and system. Background Art

[0002] During the production process of cloth, due to textile equipment failures, operator errors and other reasons, cloth has defects of different forms, which seriously affects the quality of the cloth. At present, most small and medium-sized cloth enterprises still rely on workers' personal experience to judge defects, making the quality of related products unable to be guaranteed. Therefore, an effective automated cloth defect detection method is urgently needed.

[0003] At present, fabric defect detection methods can be mainly divided into statistical methods, frequency domain methods, model methods and deep learning methods. Among them, the method based on deep learning has strong robustness for different application scenarios and has gradually become a research hotspot. Deep learning methods can be divided into two modes: supervised learning and unsupervised learning. Supervised learning requires the collection of a large number of normal samples and defective samples, and accurate labeling of defective areas. However, in the actual production process, the number of defective samples is scarce and the sample types are unbalanced, which brings difficulties to the supervised learning-based methods and the detection accuracy is relatively low. Although unsupervised learning can only use normal samples to train the model, it usually requires a high amount of computing and has high requirements on the hardware platform, and it is difficult to run on an embedded platform. Summary of the invention

[0004] In view of the above defects or improvement needs of the prior art, the present invention provides a cloth defect detection method and system to solve the technical problem that the prior art cannot accurately perform cloth defect detection with high computational efficiency.

[0005] In order to achieve the above object, in a first aspect, the present invention provides a cloth defect detection method, comprising the following steps:

[0006] S1. Input the cloth sample to be tested into the pre-trained lightweight generative adversarial network to obtain a reconstructed image of the cloth sample to be tested;

[0007] S2, comparing the difference between the cloth sample to be tested and its reconstructed image to detect cloth defects;

[0008] The above-mentioned lightweight generative adversarial network includes a lightweight generator and a discriminator; the lightweight generator is used to generate a reconstructed image of an input cloth sample; the discriminator is used to determine whether the input image is a real cloth sample or a generated reconstructed image;

[0009] The lightweight generator includes: an encoder and a decoder;

[0010] The encoder includes a series of convolutional layers and bottleneck modules; the bottleneck module includes multiple bottleneck layers that are connected in series from large to small in size; each bottleneck layer in the encoder is connected to an activation layer;

[0011] The bottleneck layer in the decoder is mirror-symmetric to the bottleneck layer in the encoder. The bottleneck layers of different sizes in the decoder are upsampled through deconvolution layers. Each bottleneck layer in the decoder is connected to an activation layer.

[0012] The feature maps with equal length and width obtained in the encoder and decoder are concatenated using skip connections;

[0013] The bottleneck layer includes: a standard convolution layer, a depth convolution layer, a channel attention module and a point convolution layer connected in series; and the input end and the output end of the bottleneck layer are jump-connected.

[0014] Further preferably, the above-mentioned lightweight generative adversarial network training method includes: copying the collected defect-free cloth sample set into two copies, adding random noise to the samples in one of the defect-free cloth sample set as the input of the lightweight generative adversarial network, and using the other defect-free cloth sample set as the output of the lightweight generative adversarial network, and training the lightweight generative adversarial network by conducting a game between the lightweight generator and the discriminator.

[0015] Further preferably, the random noise is salt and pepper noise or Gaussian noise.

[0016] Further preferably, step S2 includes: calculating the absolute value of the difference between the cloth sample to be tested and its reconstructed image pixel by pixel to obtain a residual image of the cloth sample to be tested, and performing morphological processing on the residual image to obtain a mask image of the defect position, thereby realizing the detection of cloth defects.

[0017] Further preferably, the method of performing morphological processing on the residual image comprises: performing Gaussian processing, threshold binarization processing and opening operation on the residual image in sequence.

[0018] Further preferably, the loss function of the above lightweight generative adversarial network includes: a generation loss function and a discrimination loss function;

[0019] The generated loss function is:

[0020]

[0021] The discriminant loss function is:

[0022] L D (I,I')=||D(I)-D(I')|| 2

[0023] Where, I is a non-defective cloth sample; I' is the image generated by inputting the non-defective cloth sample with random noise added into the lightweight generator; μ I and μ I' are the means of I and I' respectively; σ I and σ I' are the variances of I and I' respectively; σ I,I' is the covariance of I and I'; C 1 , C 2 and C 3 They are all constants to maintain numerical stability; α, β and γ are all adjustment factors; D(I) is the result of I after being judged by the discriminator;

[0024] The generative loss function is used to measure the similarity between I and I'; the discriminative loss function is used to measure the similarity between the results obtained after I and I' are discriminated by the discriminator.

[0025] In a second aspect, the present invention provides a cloth defect detection system, comprising:

[0026] An image reconstruction module is used to input the cloth sample to be tested into a pre-trained lightweight generative adversarial network to obtain a reconstructed image of the cloth sample to be tested;

[0027] A defect detection module is used to compare the difference between the cloth sample to be tested and its reconstructed image to detect cloth defects;

[0028] The above-mentioned lightweight generative adversarial network includes a lightweight generator and a discriminator; the lightweight generator is used to generate a reconstructed image of an input cloth sample; the discriminator is used to determine whether the input image is a real cloth sample or a generated reconstructed image;

[0029] The lightweight generator includes: an encoder and a decoder;

[0030] The encoder includes a series of convolutional layers and bottleneck modules; the bottleneck module includes multiple bottleneck layers that are connected in series from large to small in size; each bottleneck layer in the encoder is connected to an activation layer;

[0031] The bottleneck layer in the decoder is mirror-symmetric to the bottleneck layer in the encoder. The bottleneck layers of different sizes in the decoder are upsampled through deconvolution layers. Each bottleneck layer in the decoder is connected to an activation layer.

[0032] The feature maps with equal length and width obtained in the encoder and decoder are concatenated using skip connections;

[0033] The bottleneck layer includes: a standard convolution layer, a depth convolution layer, a channel attention module and a point convolution layer connected in series; and the input end and the output end of the bottleneck layer are jump-connected.

[0034] In a third aspect, the present invention provides a cloth defect detection system, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor executes the cloth defect detection method provided in the first aspect of the present invention when executing the computer program.

[0035] In a fourth aspect, the present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the cloth defect detection method provided in the first aspect of the present invention.

[0036] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects:

[0037] 1. The present invention provides a method for detecting cloth defects, constructs a lightweight generative adversarial network, reconstructs a cloth sample to be tested, and the reconstructed image is a defect-free image of the cloth sample to be tested. By comparing the difference between the reconstructed image and the cloth sample to be tested, it is determined whether the cloth sample to be tested has defects and the defect location. The main structure of the lightweight generative adversarial network is composed of a bottleneck layer. The bottleneck layer achieves the same effect as the standard two-dimensional convolution through serially connected deep convolution and point convolution, but the amount of calculation is lower, and cloth defects can be accurately detected with high computational efficiency.

[0038] 2. In the cloth defect detection method provided by the present invention, the loss function of the lightweight generative adversarial network includes a generation loss function and a discriminant loss function; wherein, the generation loss function is used to measure the similarity between the image generated after the defect-free cloth sample after adding random noise is input into the lightweight generator and the corresponding defect-free cloth sample. The loss function controls the influence of brightness similarity, contrast similarity and structural similarity in the reconstructed image by adjusting factors α, β and γ, thereby further enhancing the reconstruction effect of the lightweight generator.

[0039] 3. The cloth defect detection method provided by the present invention uses a morphological method to detect cloth defects, including performing Gaussian processing, threshold binarization processing and opening operation on the residual image in sequence; wherein the Gaussian processing makes the residual image value tend to be smooth to facilitate subsequent segmentation, the threshold binarization converts the residual image into a binary image, and the opening operation eliminates isolated points and hole areas in the binary image to make the segmented image more accurate.

[0040] 4. The cloth defect detection method provided by the present invention adopts an unsupervised learning method to train a lightweight generative adversarial network. During training, random noise is added to the input image to enhance the reconstruction ability of the lightweight generator. This can effectively solve the problems of scarce defect samples and unbalanced defect samples in the cloth production process, and greatly improves the speed and accuracy of cloth defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A flow chart of a cloth defect detection method provided in Example 1 of the present invention;

[0042] Figure 2 A schematic diagram of the structure of a lightweight generative adversarial network provided in Example 1 of the present invention;

[0043] Figure 3 A schematic diagram of the structure of a lightweight generator provided in Example 1 of the present invention;

[0044] Figure 4 A schematic diagram of the structure of the bottleneck layer provided in Example 1 of the present invention;

[0045] Figure 5 A schematic diagram of the structure of a discriminator provided in Embodiment 1 of the present invention;

[0046] Figure 6 This is a schematic diagram of the cloth defect detection results provided in Example 1 of the present invention. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solutions 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.

[0048] Embodiment 1,

[0049] A cloth defect detection method, such as Figure 1 As shown, the following steps are included:

[0050] S1. Input the cloth sample to be tested into a pre-trained lightweight generative adversarial network to obtain a reconstructed image of the cloth sample to be tested; the obtained reconstructed image is a defect-free image of the cloth sample to be tested.

[0051] Specifically, the training method of the above-mentioned lightweight generative adversarial network includes: copying the collected defect-free cloth sample set into two copies, adding random noise to the samples in one of the defect-free cloth sample set as the input of the lightweight generative adversarial network, and not doing any processing on the other defect-free cloth sample set, and using it as the output of the lightweight generative adversarial network, and training the lightweight generative adversarial network by playing a game between the lightweight generator and the discriminator. Among them, the random noise is salt and pepper noise or Gaussian noise. The lightweight generative adversarial network in this embodiment uses the Adam optimizer to update parameters during the training process.

[0052] like Figure 2 As shown, the above lightweight generative adversarial network includes a lightweight generator and a discriminator; the lightweight generator is used to generate a reconstructed image of the input cloth sample; specifically, Figure 3 As shown, the lightweight generator includes: an encoder and a decoder;

[0053] In this embodiment, the encoder includes a convolutional layer and a bottleneck module connected in series; the bottleneck module includes a plurality of bottleneck layers connected in series in descending order of size; each bottleneck layer in the encoder is connected to an activation layer;

[0054] The decoder also includes the above-mentioned bottleneck layer. The placement of the bottleneck layer in the decoder is mirror-symmetrical to that in the encoder. The bottleneck layers of different sizes in the decoder are upsampled through deconvolution layers. Each bottleneck layer in the decoder is connected to an activation layer.

[0055] The feature maps with equal length and width obtained in the encoder and decoder are concatenated using skip connections;

[0056] Furthermore, if Figure 4 As shown, the bottleneck layer includes: a series of standard convolution layers (1*1 standard convolution is selected in this embodiment), a depth convolution layer (3*3 depth convolution is selected in this embodiment), a channel attention module and a point convolution layer (1*1 point convolution is selected in this embodiment); and the input end and the output end of the bottleneck layer are jump-connected, and the feature map of the input bottleneck layer and the feature map output from the bottleneck layer are added through the jump connection.

[0057] It should be noted that the bottleneck layer achieves the same effect as the standard two-dimensional convolution through the series of deep convolution and point convolution, but the amount of calculation is lower, and it can accurately detect cloth defects with high computational efficiency. Specifically, when the input feature map size is H in W in C in , the convolution kernel size is K*K, and the output feature map size is H out W out C outWhen , the computational complexity of a standard convolution is: P 1 =K 2 C in C out ×H out W out ; The bottleneck layer can be decomposed into two parts: depth convolution and point convolution, so the computational complexity of depth separable convolution is: P 2 =K 2 C in ×H out W out +C in C out ×H out W out . It can be seen that the ratio of the computational effort of a bottleneck layer to that of a standard convolution is: The bottleneck layer is mainly composed of convolution kernels of size 3*3. Therefore, in general, the bottleneck layer is about 9 times less computationally intensive than the standard two-dimensional convolution, but the computational complexity is lower.

[0058] The discriminator is used to determine whether the input image is a real cloth sample or a generated reconstruction image; specifically, Figure 5 As shown, in this embodiment, the discriminator includes a cascaded convolution layer, an activation layer, and a pooling layer.

[0059] Furthermore, the loss function of the above lightweight generative adversarial network includes: a generation loss function and a discrimination loss function;

[0060] The generated loss function is:

[0061] L G (I,I')=1-I(I,I') α c(I,I') β s(I,I') γ

[0062]

[0063]

[0064]

[0065] The discriminant loss function is:

[0066] L D (I,I')=||D(I)-D(I')|| 2

[0067] Where I is a non-defective cloth sample; I' is the image generated by inputting the non-defective cloth sample with random noise into the lightweight generator; I(I,I') is the brightness comparison value of I and I'; c(I,I') is the contrast comparison value of I and I'; s(I,I') is the structural comparison value of I and I'; l(I,I') α c(I,I') β s(I,I') γ It is used to measure the structural similarity between I and I'. The closer its value is to 1, the more similar I and I' are. I and μ I' are the means of I and I' respectively; σ I and σ I' are the variances of I and I' respectively; σ I,I' is the covariance of I and I'; C 1 , C 2 and C 3 are all constants for maintaining numerical stability; α, β and γ are adjustment factors, which are used to adjust the importance of brightness contrast value, contrast contrast value and structure contrast value respectively (all take the value of 1 in this embodiment); D represents the discriminator; D(I) is the result of I after being discriminated by the discriminator.

[0068] Specifically, the generation loss function is used to measure the similarity between I and I'; the discriminant loss function is used to measure the similarity of the results obtained after I and I' are discriminated by the discriminator.

[0069] S2, comparing the difference between the cloth sample to be tested and its reconstructed image to detect cloth defects;

[0070] Specifically, in an optional implementation, the absolute value of the difference between the cloth sample to be tested and its reconstructed image is calculated pixel by pixel to obtain a residual image of the cloth sample to be tested, and the residual image is morphologically processed to obtain a mask image of the defect position, thereby realizing the detection of cloth defects. Among them, the method of morphologically processing the residual image includes: performing Gaussian filtering on the residual image; performing threshold binarization on the image after Gaussian filtering; and performing an opening operation on the image after binarization. In the morphological processing method, the specific parameter values ​​of the Gaussian kernel size, the binarization threshold, and the opening operation kernel size are obtained by parameter estimation using the Bayesian optimization method. Specifically, as Figure 6 The figure shows a schematic diagram of cloth defect detection results, wherein the first column is the cloth samples to be tested, the second column is the real defects of the cloth samples to be tested, the third column is the reconstructed images of the cloth samples to be tested, and the fourth column is the defect detection results of the cloth samples to be tested; it can be seen from the figure that the detection results of the cloth samples to be tested by the present invention are basically exactly the same as the real defects, and the accuracy of defect detection is high.

[0071] In another optional implementation, by comparing the structural similarity between the cloth sample to be tested and its reconstructed image, the cloth defects are detected according to the degree of similarity. If the difference between the cloth sample to be tested and its reconstructed image is less than a preset difference value, the cloth sample to be tested has no defects; otherwise, the cloth sample to be tested has defects, and the area on the cloth sample to be tested that is different from its reconstructed image is the defect location.

[0072] In order to further illustrate the performance of the cloth defect detection method provided by the present invention, the convolutional denoising autoencoder model (CDAE), the multi-scale convolutional denoising autoencoder model (MSCDAE), the U-shaped convolutional denoising autoencoder model (UCDAE) and the lightweight generative adversarial network (LCD-GAN) proposed by the present invention are trained respectively, and verified on the textile defect dataset. The performance of the above models is evaluated using accuracy, precision and recall as evaluation indicators, and the results shown in Table 1 are obtained:

[0073] Table 1

[0074] Model Accuracy Accuracy Recall CDAE 0.9575 0.9741 0.9400 MSCDAE 0.9625 0.9792 0.9450 UCDAE 0.9725 0.9846 0.9600 The present invention 0.9750 0.9796 0.9695

[0075] It can be seen from Table 1 that compared with other models, the lightweight generative adversarial network provided by the present invention performs best in terms of accuracy and recall rate indicators. At the same time, the accuracy also reaches 97.96%, and the overall performance is good.

[0076] In addition, due to the lightweight design of the lightweight generative adversarial network, it has better performance in inference speed. Table 2 shows the actual time consumption comparison of different models on the GPU and CPU of the training platform.

[0077] Table 2

[0078]

[0079]

[0080] From Table 2, it can be seen that the algorithm reasoning speed of the lightweight generative adversarial network provided by the present invention is much faster than other models. The reasoning time is 33.4ms when GPU acceleration is used, and the reasoning time is 78.1ms when only CPU is used. The operation speed is much faster than other models. From Tables 1 and 2, it can be seen that the lightweight generative adversarial network proposed by the present invention can significantly improve the reasoning speed while ensuring high detection accuracy.

[0081] Embodiment 2,

[0082] A cloth defect detection system, comprising:

[0083] An image reconstruction module is used to input the cloth sample to be tested into a pre-trained lightweight generative adversarial network to obtain a reconstructed image of the cloth sample to be tested;

[0084] A defect detection module is used to compare the difference between the cloth sample to be tested and its reconstructed image to detect cloth defects;

[0085] The above-mentioned lightweight generative adversarial network includes a lightweight generator and a discriminator; the lightweight generator is used to generate a reconstructed image of an input cloth sample; the discriminator is used to determine whether the input image is a real cloth sample or a generated reconstructed image;

[0086] The lightweight generator includes: an encoder and a decoder;

[0087] The encoder includes a series of convolutional layers and bottleneck modules; the bottleneck module includes multiple bottleneck layers that are connected in series from large to small in size; each bottleneck layer in the encoder is connected to an activation layer;

[0088] The decoder also includes the above-mentioned bottleneck layer. The placement of the bottleneck layer in the decoder is mirror-symmetrical to that in the encoder. The bottleneck layers of different sizes in the decoder are upsampled through deconvolution layers. Each bottleneck layer in the decoder is connected to an activation layer.

[0089] The feature maps with equal length and width obtained in the encoder and decoder are concatenated using skip connections;

[0090] The bottleneck layer includes: a series of standard convolution layers (1*1 standard convolution is selected in this embodiment), a depth convolution layer (3*3 depth convolution is selected in this embodiment), a channel attention module and a point convolution layer (1*1 point convolution is selected in this embodiment); and the input end and the output end of the bottleneck layer are jump-connected, and the feature map of the input bottleneck layer and the feature map output from the bottleneck layer are added through the jump connection.

[0091] The relevant technical solution is the same as that in Example 1 and will not be described in detail here.

[0092] Embodiment 3,

[0093] A cloth defect detection system comprises: a memory and a processor, wherein the memory stores a computer program, and the processor executes the cloth defect detection method provided in Embodiment 1 of the present invention when executing the computer program.

[0094] The relevant technical solution is the same as that in Example 1 and will not be described in detail here.

[0095] Embodiment 4,

[0096] A machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the cloth defect detection method provided in Example 1 of the present invention.

[0097] The relevant technical solution is the same as that in Example 1 and will not be described in detail here.

[0098] 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 cloth defect detection method, characterized in that: The following steps are involved: S1. Inputting the cloth sample to be tested into a pre-trained lightweight generative adversarial network to obtain a reconstructed image of the cloth sample to be tested; S2, comparing the difference between the cloth sample to be tested and its reconstructed image to detect cloth defects; The lightweight generative adversarial network includes a lightweight generator and a discriminator; the lightweight generator is used to generate a reconstructed image of an input cloth sample; the discriminator is used to determine whether the input image is a real cloth sample or a generated reconstructed image; The lightweight generator includes: an encoder and a decoder; the feature maps with equal length and width obtained in the encoder and the decoder are spliced ​​using a skip connection method; The encoder includes a convolutional layer and a bottleneck module connected in series; the bottleneck module includes a plurality of bottleneck layers connected in series in descending order of size; each bottleneck layer in the encoder is connected to an activation layer; The decoder also includes the bottleneck layer; the bottleneck layer in the decoder is mirror-symmetric to the bottleneck layer in the encoder, and bottleneck layers of different sizes in the decoder are upsampled through a deconvolution layer; each bottleneck layer in the decoder is connected to an activation layer; The bottleneck layer includes: a standard convolution layer, a depth convolution layer, a channel attention module and a point convolution layer connected in series; and the input end and the output end of the bottleneck layer are jump-connected.

2. The cloth defect detection method according to claim 1, characterized in that: The training method of the lightweight generative adversarial network includes: copying the collected defect-free cloth sample set into two copies, adding random noise to the samples in one of the defect-free cloth sample set as the input of the lightweight generative adversarial network, and using the other defect-free cloth sample set as the output of the lightweight generative adversarial network, and training the lightweight generative adversarial network by conducting a game between the lightweight generator and the discriminator.

3. The cloth defect detection method according to claim 2, characterized in that: The random noise is salt and pepper noise or Gaussian noise.

4. The cloth defect detection method according to claim 1, characterized in that: The step S2 comprises: calculating the absolute value of the difference between the cloth sample to be tested and its reconstructed image pixel by pixel to obtain a residual image of the cloth sample to be tested, and performing morphological processing on the residual image to obtain a mask image of the defect position, thereby realizing the detection of cloth defects.

5. The cloth defect detection method according to claim 4, characterized in that: The method for performing morphological processing on the residual image comprises: performing Gaussian processing, threshold binarization processing and opening operation on the residual image in sequence.

6. The cloth defect detection method according to claim 1, characterized in that: The loss function of the lightweight generative adversarial network includes: a generation loss function and a discrimination loss function; The generated loss function is: The discriminant loss function is: L D (I,I')=||D(I)-D(I')|| 2 Where, I is a non-defective cloth sample; I' is the image generated by inputting the non-defective cloth sample with random noise added into the lightweight generator; μ I and μ I' are the means of I and I' respectively; σ I and σ I' are the variances of I and I' respectively; σ I,I' is the covariance of I and I'; C1, C2 and C3 are constants to maintain numerical stability; α, β and γ are adjustment factors; D(I) is the result of I after being judged by the discriminator.

7. A cloth defect detection system, characterized in that: include: An image reconstruction module is used to input the cloth sample to be tested into a pre-trained lightweight generative adversarial network to obtain a reconstructed image of the cloth sample to be tested; A defect detection module, used for comparing the difference between the cloth sample to be tested and its reconstructed image, so as to detect cloth defects; The lightweight generative adversarial network includes a lightweight generator and a discriminator; the lightweight generator is used to generate a reconstructed image of an input cloth sample; the discriminator is used to determine whether the input image is a real cloth sample or a generated reconstructed image; The lightweight generator includes: an encoder and a decoder; the feature maps with equal length and width obtained in the encoder and the decoder are spliced ​​using a skip connection method; The encoder includes a convolutional layer and a bottleneck module connected in series; the bottleneck module includes a plurality of bottleneck layers connected in series in descending order of size; each bottleneck layer in the encoder is connected to an activation layer; The decoder also includes the bottleneck layer; the bottleneck layer in the decoder is mirror-symmetric to the bottleneck layer in the encoder, and bottleneck layers of different sizes in the decoder are upsampled through a deconvolution layer; each bottleneck layer in the decoder is connected to an activation layer; The bottleneck layer includes: a standard convolution layer, a depth convolution layer, a channel attention module and a point convolution layer connected in series; and the input end and the output end of the bottleneck layer are jump-connected.

8. A cloth defect detection system, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and the processor executes the cloth defect detection method according to any one of claims 1 to 6 when executing the computer program.

9. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions prompt the processor to implement the cloth defect detection method described in any one of claims 1-6.

Citation Information

Patent Citations

  • Photovoltaic module unsupervised defect detection method based on GAN improved algorithm

    CN111340791A

  • Cloth defect detection method based on adversarial neural network, terminal and storage medium

    CN111724372A

  • Surface defect detection method based on multi-scale convolution and trilinear global attention

    CN112465790A

  • Cloth defect detection method based on adversarial neural network, and terminal and storage medium

    WO2021253632A1