Cloth flaw image generation method based on improved CycleGAN

By improving the CycleGAN network, introducing the CoordConv and EMA attention modules, and replacing the CARAFE module in the decoder, ECC-CycleGAN was constructed. This solved the problem of insufficient quality and diversity in fabric defect image generation, achieving high-quality and diverse defect image generation and improving the performance of the defect detection model.

CN119006367APending Publication Date: 2024-11-22ZHEJIANG SCI-TECH UNIV

Patent Information

Application Number
CN202410953984.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

Existing image generation methods struggle to generate high-quality, diverse images of fabric defects. Traditional methods have limited capacity to expand the number of images, while deep learning algorithms such as GANs are unstable during training and generate uncontrollable features. CycleGAN suffers from feature loss and low quality in generating fabric defect images.

Method used

The CycleGAN network is improved by introducing the CoordConv module to replace the convolutional layer of the encoder, adding the EMA attention module, and replacing the deconvolution of the decoder with the CARAFE module. This constructs the ECC-CycleGAN network, which enhances spatial awareness and feature preservation capabilities and optimizes the training process of the generator and discriminator.

Benefits of technology

It improves the quality and diversity of generated fabric defect images, reduces the number of parameters, avoids feature loss, and the generated dataset helps to improve the generalization and detection accuracy of the defect detection model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119006367A_ABST
    Figure CN119006367A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image conversion and generation, and discloses a cloth defect image generation method based on an improved CycleGAN, which comprises the steps of collecting a cloth surface picture, cutting the cloth surface picture in an upper computer, and then inputting a selected cloth image with defects and a random contour feature map into an ECC-CycleGAN network, and outputting a fabric defect picture corresponding to the shape of the contour feature map. The ECC-CyclGAN network is based on the CyclGAN network, a discriminator of the CyclGAN network is kept unchanged, an original encoder of a generator is replaced by a CE encoder, and an original decoder is replaced by a C decoder. Compared with the original CycleGAN network, the ECC-CycleGAN network has the advantages that the parameter quantity is reduced, the quality and diversity of the generated cloth defect images are greatly improved, and the generation capability of the cloth defect data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image conversion and generation, and in particular relates to a method for generating cloth defect images based on an improved CycleGAN. Background Art

[0002] Fabric quality control is crucial to improving the competitiveness of textile enterprises, and defect detection is its core link. Although the traditional manual visual inspection method is direct, it is inefficient and costly. In recent years, the application of deep learning algorithms in the field of automated defect detection has been increasing, significantly improving detection efficiency and reducing labor costs. However, the effectiveness of deep learning algorithms is highly dependent on the training of a large amount of high-quality defect image data. The acquisition process of cloth defect images is not only cumbersome, but also challenging to obtain sufficient and diverse sample data, especially images of rare defect types. Therefore, developing a high-quality image generation method that can accurately control the generation of defect image features is of great significance to improving the performance and generalization of defect detection models.

[0003] Traditional image generation methods augment images by using brightness enhancement, geometric transformation, color gamut transformation, noise injection, and local erasure on the original image. However, the new images generated by these traditional image generation methods may retain highly similar information to the original images. Traditional data enhancement methods can indeed expand the number of original data sets, but cannot increase the diversity of the data sets.

[0004] With the development of deep learning technology, image generation technology has become more mature, and various excellent generation algorithms have emerged. The classic generation algorithms include VAE, GAN and DDPM: VAE generates images by mapping the input to a Gaussian distribution, sampling it, and passing it through a decoder. The loss function is designed by reconstruction loss and kl divergence to control the similarity between the generated image and the original image, and the generated images are more diverse. GAN uses the zero-sum game idea to conduct adversarial training between the generator and the discriminator to obtain the superposition optimization of the generation performance and the discrimination performance, making the generated image more realistic. DDPM gradually adds noise to the original image in the forward process. The network learns the process of adding noise through the forward process, so as to help the neural network train the reverse process and realize the reverse denoising of the noisy image to achieve the function of generating images. However, the image generation quality of the VAE algorithm is poor, and the training cost of diffusion models such as DDPM is too high, so many research works are based on the GAN model for improvement. The adversarial generative network GAN has excellent ability to simulate data distribution. Its proposal and development have well solved the problem of unbalanced and insufficient data samples, and it has made remarkable achievements in image super-resolution, text-to-image synthesis, image-to-image translation, etc. However, GAN trains both the discriminator and the generator network at the same time, which makes the model training extremely unstable, prone to problems such as gradient disappearance and mode collapse, and its image generation is insufficient in diversity and uncontrolled. Therefore, the subsequent CycleGAN adds constraints to the image generation process through the cycle consistency principle, so that the image will also retain some features during the generation process, improving the similarity between the generated image structure and the original image. In addition, CycleGAN can generate images without paired data and can transfer the style of images. It has the ability to generate features required for defect image generation, but there are problems such as easy loss of features during image generation and low quality of generated images, which is not suitable for direct use in the generation of cloth defect images. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a cloth defect image generation method based on improved CycleGAN, so as to generate high-quality cloth defect images.

[0006] In order to solve the above technical problems, the present invention provides a method for generating cloth defect images based on improved CycleGAN, the specific process includes collecting cloth surface pictures, cutting and processing the collected cloth surface pictures in a host computer, and then inputting the selected cloth images with defects and feature contour maps into an ECC-CycleGAN network, and outputting a fabric defect picture corresponding to the shape of the contour feature map;

[0007] The ECC-CycleGAN network is based on the CycleGAN network, and the discriminator of the CycleGAN network remains unchanged, and the original encoder of the generator is replaced by the CE encoder, and the original decoder is replaced by the C decoder.

[0008] As an improvement of the cloth defect image generation method of improving CycleGAN of the present invention:

[0009] The cropping process is to crop the original collected images into a group of small-sized images and select the cloth images with defects, and then each cloth image with defects corresponds to a random contour feature map of the same size.

[0010] As a further improvement of the cloth defect image generation method of an improved CycleGAN of the present invention:

[0011] The CE encoder replaces the convolutions of the third to sixth layers of the encoder of the CycleGAN network generator with CoordConv modules, and adds an EMA attention module after the last convolution layer of the encoder.

[0012] As a further improvement of the cloth defect image generation method of an improved CycleGAN of the present invention:

[0013] The C decoder replaces the first deconvolution of the decoder of the CycleGAN network generator with a CARAFE module.

[0014] As a further improvement of the cloth defect image generation method of an improved CycleGAN of the present invention:

[0015] The training and testing process of the ECC-CycleGAN network is as follows:

[0016] The cloth images are collected and divided into a training set and a test set after the cropping process; the cloth defect images and feature contour images in the training set are then input into the ECC-CycleGAN network, and the generation ability of the generator and the discrimination ability of the discriminator are optimized through the adversarial loss function, so that the image generation quality is gradually improved, and part of the feature structure of the original image is retained through the cycle consistency loss function, and the training is completed after reaching the preset number of epochs. Then the feature contour image and cloth defect image of the test set are input into the ECC-CycleGAN network to test and verify the model.

[0017] The beneficial effects of the present invention are mainly reflected in:

[0018] 1. Compared with the original CycleGAN network, the ECC-CycleGAN network of the present invention reduces the number of parameters, and the quality and diversity of the generated cloth defect images are greatly improved, which improves the ability to generate cloth defect data, so that uncommon or difficult to collect cloth defect images can be generated with high quality;

[0019] 2. Compared with the original CycleGAN network, the ECC-CycleGAN model of the present invention avoids the problems of easy feature loss and low quality of generated images, and the generated data set is helpful for training the generalization and detection accuracy of the cloth defect target detection model;

[0020] 3. The present invention uses CoordConv to replace the convolution of the third to sixth layers of the encoder of the original CycleGAN network, introducing coordinate information into the encoding part of the generator, so that the model acquires spatial perception ability and is more sensitive to image position information.

[0021] 4. The encoder of the ECC-CycleGAN model of the present invention uses EMA after the last convolutional layer to retain key feature information and position information, providing high-quality input for the subsequent decoder upsampling image generation.

[0022] 5. In the generator of the ECC-CycleGAN model of the present invention, the CARAFE lightweight operator is used to replace the first deconvolution of the decoder upsampling, and the position information obtained by CoordConv and EMA are used to retain the key feature information for upsampling, so that the model generator pays more attention to the feature structure of the defective picture, so as to achieve the effect of the defect features required for image generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The specific implementation modes of the present invention are further described in detail below with reference to the accompanying drawings.

[0024] Figure 1 Schematic diagram of the structure of the CycleGAN network based on ;

[0025] Figure 2 Schematic diagram of the generator structure of the CycleGAN network based on ;

[0026] Figure 3 Schematic diagram of the discriminator structure of the CycleGAN network based on ;

[0027] Figure 4 Schematic diagram of the generator structure of ECC-CycleGAN of the present invention;

[0028] Figure 5 Schematic diagram of the CoordConv structure;

[0029] Figure 6 Schematic diagram of the EMA attention mechanism structure;

[0030] Figure 7 It is a schematic diagram of the CARAFE upsampling structure;

[0031] Figure 8 This is an example of a real cloth defect data image collected;

[0032] Fig. 9 The generated cloth defect data images ((a) is the image generated by CycleGAN, (b) is the calibrated contour feature map, and (c) is the image generated by ECC-CycleGAN). DETAILED DESCRIPTION

[0033] The present invention is further described below in conjunction with specific embodiments, but the protection scope of the present invention is not limited thereto:

[0034] Example 1: A method for generating cloth defect images based on improved CycleGAN, which improves the baseline CycleGAN network into an ECC-CycleGAN network, solves the problems of poor quality of cloth defect images generated using traditional generative adversarial models, a single type of defective images generated, and uncontrollable generated features. First, CoordConv is introduced in the encoder of the generator to provide feature coordinate information for the encoder, so that it can obtain spatial perception ability and be more sensitive to image position information. Secondly, EMA attention is added after the encoder downsampling to reshape part of the channel dimensions into batch dimensions, reduce the impact of dimensionality reduction on cross-channel relationship modeling, and retain the key information of each channel. Finally, the CARAFE lightweight upsampling operator is used to improve the decoding part of the generator. According to the content-adaptive kernel, the receptive field is expanded while reducing the number of model parameters, and contextual information can be aggregated, so that the model has a stronger ability to learn cloth defect features and better image generation quality. The details are as follows:

[0035] 1. Improve the CycleGAN network

[0036] 1.1. Baseline CycleGAN Network

[0037] The CycleGAN network consists of two parts: the generator and the discriminator. Figure 1 As shown in Figure 1. The generator G of the CycleGAN network completes the mapping from domain X to domain Y, and the generator F completes the mapping from domain Y to domain X. Generators G and F use the same generation network structure, both in the form of encoders and decoders, as shown in Figure 1. Figure 2As shown in the figure, the encoder is composed of seven convolutions to achieve feature extraction, and the decoder is composed of seven deconvolutions to achieve image generation. The discriminator Dx and the discriminator Dy of the CycleGAN network are both composed of five CIL modules, which include convolution, InstanceNorm normalization and LeakyReLU activation function in sequence, as shown in Figure 3 As shown in the figure. After the image generated by the generator is input into the five CIL modules of the discriminator, an N×N discriminant matrix will be output to distinguish the true and false of the image by region, and the generator and discriminator are optimized through the adversarial loss function. In order to allow the generator to retain some features during the generation process and improve the similarity between the generated image and the original image, another generator is used to perform an inverse transformation to convert the generated image into the original image. By comparing the original image with the generated original image, a cycle consistency loss function is designed to control the original image and the generated image to retain a certain similarity.

[0038] The ECC-CycleGAN network of the present invention mainly improves the encoder and decoder of the generator to make it more suitable for the generation scenario of cloth defect images.

[0039] 1.2. CE encoder that can obtain coordinate information

[0040] CoordConv is introduced into the encoder of the generator, and EMA attention is added after the encoder downsampling to construct the CE encoder of the present invention.

[0041] (1) In the encoder, CoordConv is introduced to replace the original convolution for downsampling. The convolutions from the third to the sixth layers of the original encoder are replaced with CoordConv, and a new feature extraction structure is constructed, such as Figure 4 As shown in Figure 1. CoordConv adds two additional coordinate channels to the original input channels so that the convolution can obtain its own input coordinates. Therefore, the network can learn complete transformation invariance or different degrees of transformation dependence, which can help the network obtain more position information and learn the spatial relationship of the input data, thereby improving the performance of the model. The structure is as follows: Figure 5 As shown in the figure. Considering that CoordConv will add two input channels to the convolution layer, which will increase the number of parameters and FLOPS, in order to simplify the model structure, we only replace the convolutions from the third to the sixth layers in the middle of the downsampling. The model obtains a large amount of position information while adding a small amount of parameters, which is of great help to the subsequent decoder in generating high-quality images.

[0042] (2) Introducing EMA (efficient multi-scale attention)

[0043] The EMA attention module is an efficient multi-scale attention module for cross-space learning. Its structure is as follows Figure 6 As shown. Although most channel or spatial attention mechanisms can effectively produce more recognizable feature representations, these attentions may affect the extraction of deep visual representations by modeling cross-channel relationships through channel dimensionality reduction. To solve this problem, the EMA attention module reshapes some channels to the batch dimension and groups the channel dimension into multiple sub-features so that the spatial semantic features are evenly distributed within each feature group. To retain the key information of each channel and reduce computational costs. In addition, the module also recalibrates the channel weights in each parallel branch by encoding global information, and captures pixel-level relationships through cross-dimensional interactions, improving the model's ability to process features. Adding the EMA module after downsampling the last convolutional layer of the encoder can retain most of the position information and key information obtained by feature extraction, providing more concise and important features for the subsequent decoder. These features enable the image to more effectively retain the main structure of the image during the encoder generation process.

[0044] 1.3 C decoder using CARAFE upsampling

[0045] CARAFE upsampling is a new type of lightweight upsampling that can generate adaptive kernels based on content perception and aggregate context information. It is different from the previous bilinear interpolation of sub-pixel neighborhoods and deconvolution of fixed kernels. Its structure is divided into two parts: kernel prediction module and content-aware reconstruction module, such as Figure 7 As shown: the kernel prediction module first compresses the channels of the original feature map through a 1×1 convolution in the channel compressor to reduce the amount of calculation. Secondly, the content encoder uses a kencoder×kencoder convolution layer to predict the upsampling kernel for the feature map output by the channel compressor, so that a larger upsampling kernel can be obtained, thereby obtaining a larger receptive field. Finally, the kernel normalizer uses SoftMax to normalize the upsampling kernel. The content-aware reorganization module maps each position of the output feature map back to the input feature map, and then performs a dot product operation with the Kup×Kup area centered on the position and the upsampling kernel predicted at the point to obtain the output feature map. The content-aware reorganization module can make the relevant feature information in the local area get more attention, and the reorganized feature map has more semantic information than the original feature map. In the present invention, CARAFE upsampling is used to replace the first deconvolution structure in the original decoder to construct a C decoder. The model can better aggregate the feature information and position information retained by EMA, which makes the encoder feature not change during the image generation process, and its sampling kernel has a larger receptive field attribute, which makes the restoration position of the subsequent upsampling image features more accurate, and the generated image quality is higher.

[0046] In combination with steps 1.2-1.3, the present invention improves the generator of the basic model CycleGAN network, and uses the improved generator to construct the ECC-CycleGAN network as a generation model for cloth defect images. The improved generator structure is as follows: Figure 4 As shown, first build a CE encoder, specifically replace the convolution of the third to sixth layers of the feature extraction part of the encoder with the CoordConv module according to step 1.1 to obtain the position information, and then add the EMA attention module after the last convolution layer of the encoder according to step 1.2 to aggregate and retain these position information and key feature information. Then build a C decoder, replace the first deconvolution of the decoder with the CARAFE module according to step 1.3, and upsample the image based on the feature adaptive kernel with position information. ECC-CycleGAN retains the model structure of CycleGAN. The present invention mainly makes a lot of effective improvements to the generator, which not only reduces the number of generator parameters, but also improves the ability to generate cloth defect data. The most important thing is to avoid the problem of easy loss of features, and the image generation is more controllable.

[0047] 2. Model training

[0048] 2.1、Dataset establishment

[0049] The data set selected by the present invention is collected from a textile production enterprise. The cloth defect images in the data set are taken in real time by six groups of area array CCD cameras placed horizontally at the cloth outlet. The image acquisition pixels are set to 3072*96, and the storage format is jpg. The collected defect images are automatically cut into 96 pixel*96 pixel images using the crop program, and the random contour feature map calibrated with 96 pixels*96 pixels is obtained using the generate program. Then, the collected defect images and the calibrated feature contour map are used to form a data set. There are 887 collected defect images and feature contour maps, of which 817 are in the training set and 70 are in the test set. The data set contains cloth defect images with different brightness, different types of defects, and complex backgrounds to generate images that are closer to the real environment of the industrial site. The data set is authentic and effective, and has strong reliability. One of the examples of the real collected data set images is as follows: Figure 8 shown.

[0050] 2.2 Training and Testing Process

[0051] The collected defect image and feature contour image are input into the ECC-CycleGAN model constructed in step 1 for training. The feature contour image is generated into a defect image through the improved generator G, and then the generated image is restored back to the feature contour image through the improved generator F. The generator and discriminator are optimized by the adversarial loss function. The first part is the generator G(X→Y) and the discriminator D YThe second part is the generator F(Y→X) and the discriminator D X The corresponding loss functions are (1) and (2). The cycle consistency loss function is used to preserve the structural features of the original image during the generation process. Its loss function is (3). The total loss function of ECC-CycleGAN is (4). The generator and discriminator are continuously optimized through the Loss function, so that higher quality defect images can be generated.

[0052]

[0053] L(G,F,D X ,D Y )=L GAN (G,D Y ,X,Y)+L GAN (F,D X ,Y,X)+lL cyc (G,F) (4)

[0054] Among them, the calibrated feature contour image is x, the original defect image is y, is the data distribution of training sample x, is the data distribution of training sample y. The purpose of the generator is to minimize the adversarial loss, while the purpose of the discriminator is to maximize the adversarial loss.

[0055] The training parameters batch_size is set to 8 and the epoch is set to 300. During the training process, the loss function value is calculated and the model parameters are optimized by back propagation. The training ends when the 300th epoch is completed.

[0056] The testing process is to input the feature contour map and cloth defect image into the trained model, set the trained weights, generate high-quality cloth defect images with controllable features, and thus obtain an ECC-CycleGAN network that can be used online.

[0057] 3. Online use

[0058] The surface image of the cloth is collected at the cloth outlet of the cloth production line by using a CCD camera. The image acquisition pixel is set to 3072*96 and saved in jpg format. Then the collected surface image of the cloth is cut into 96 pixels*96 pixels images in the host computer and converted into a 96 pixels*96 pixels calibrated random contour feature map, from which the cloth image with defects is selected. Then the defective cloth image and feature contour map are input into the ECC-CycleGAN network obtained in step 2 and can be used online, and a high-quality fabric defect image corresponding to the shape of the contour feature map is output.

[0059] experiment:

[0060] 1. The experiment uses the data set of Example 1

[0061] 2. Evaluation indicators

[0062] Image generation algorithms are generally analyzed and evaluated from two aspects: the quality and diversity of image generation. General algorithm evaluation indicators include FID (Frechet Inception Distance) and IS (inception score). However, the IS evaluation indicator only calculates and evaluates based on the clarity and diversity of the generated image, ignoring the impact of the original data set. In addition, the IS evaluation indicator is trained in ImageNet and is not applicable to other data sets. The FID evaluation indicator is calculated based on the distance between the quality of the generated image and the original image, and the evaluation data set is not restricted. Obviously, the FID evaluation indicator is more reasonable and effective, and can better judge the quality of the generated image, so the better FID evaluation indicator is selected as the evaluation indicator of this article. In order to make the evaluation indicators of this model more diverse, PSNR is introduced as an auxiliary evaluation indicator of the model, and the number of parameters of this algorithm is counted. Therefore, the model evaluation indicators include FID, PSNR and parameter quantity:

[0063]

[0064] in, is the L2 norm of the square of the mean vector difference, Tr represents the trace of the matrix (i.e., the sum of the diagonal elements of the matrix), is the covariance matrix∑ g and∑ r The square root of the product of represents the matrix obtained by taking the square root of the eigenvalue of the product of two matrices. The lower the FID score, the closer the distribution of the generated image is to the real image, and it is generally believed that the generated image quality is higher. MSE is the mean square error of the two images; MaxValue is the maximum value that the image pixel can take.

[0065] 3. Object detection model experiment

[0066] In order to verify that the cloth defect images generated by ECC-CycleGAN are authentic and effective and can improve the detection accuracy and generalization performance of the model for cloth defects, a dataset consisting of 900 real cloth defect images was used to train the mainstream object detection model. Then, 300 cloth defect images generated by ECC-CycleGAN were added to the dataset for mixed training. The experimental results are shown in Table 1.

[0067] Table 1 Comparison of target detection algorithm performance before and after adding generated data

[0068]

[0069] The experimental results show that the mAP of each model has been greatly improved by training with the dataset of cloth defect images generated by ECC-CycleGAN, with SSD, YOLOv4-tiny, YOLOv5s, and YOLOv7-tiny increasing by 3.1%, 2.3%, 2.9%, and 6.7%, respectively. The experimental results show that the cloth defect image data generated by ECC-CycleGAN is of high quality and variety, which can improve the detection ability and generalization performance of the target detection model for cloth defects. On the basis of the original dataset, the mAP of the dataset trained with the generated data is improved on each target detection network, proving that the generated dataset has similar potential features to the original data and the generated data is also richer.

[0070] 4. Comparative Experiments on Typical Image Generation Algorithms

[0071] To verify the superiority of the overall solution, a horizontal comparison experiment was conducted with cloth defect images generated by the current mainstream image generation algorithms Neural-Style, MUINT, DRIT, StarGan-v2, and CycleGAN using the same equipment and conditions under the same data set. The experimental results are shown in Table 2:

[0072] Table 2 Performance comparison of mainstream image algorithms

[0073]

[0074] The experimental results show that the improved algorithm ECC-CycleGAN is 83.58%, 78.47%, 55.46%, 14.39%, and 16.23% lower in FID than Neural-Style, MUINT, DRIT, StarGan-v2, and CycleGAN, respectively. The PSNR index is also 20.19%, 14.49%, 11.53%, 1.49%, and 5.49% higher than Neural-Style, MUINT, DRIT, StarGan-v2, and CycleGAN, respectively. The experimental results show that compared with mainstream image generation algorithms, ECC-CycleGAN has higher image generation quality and better pattern diversity, and is a relatively excellent image generation algorithm.

[0075] 5. Ablation experiment

[0076] In order to verify the effectiveness of the improved strategy, an ablation experiment was conducted to prove the corresponding improved indicators of the strategy. EMA, CoordConv, and CARAFE were added to the original model (CycleGAN) separately or in combination to fully and meticulously reflect the optimization points of each strategy on the original model. The experimental results are shown in Table 3:

[0077] Table 3 ECC-CycleGAN ablation experiment results

[0078]

[0079] The above experimental results show that after adding EMA, CoordConv, and CARAFE to the original model, the FID values ​​increased by 2.47%, 11.91%, and 1.41% respectively; the PSNR values ​​also decreased by 0.38%, 7.13%, and 0.16%. It can be seen that the original model with the CoordConv module alone has the best effect. In the ablation experiment combining two of these modules, we found that the effect of CoordConv+CARAFE is even worse than the original model. We believe that this is because the coordinate information added by CoordConv is directly put into the CARAFE module of the adaptive upsampling kernel after encoding without being retained by the key feature fusion of the EMA module, resulting in a negative optimization effect. The addition of the EMA module perfectly solves the problem of negative optimization and even achieves an amazing improvement effect. The final model ECC-CycleGAN combined with the three modules achieved excellent results, with an FID value increase of 17.18%, a PSNR decrease of 14.65%, and a parameter reduction of 8.94%.

[0080] In general, the experimental results effectively prove that the combination of these three improvement strategies has the best effect. Compared with the original model, the ECC-CycleGAN network has greatly improved image quality and diversity while reducing the number of parameters. The feasibility of the improved method has been confirmed through ablation experiments.

[0081] In order to more directly and clearly reflect the effect of the improved model, the generated image of CycleGAN, the calibrated contour map and the generated image of ECC-CycleGAN are displayed, as shown in the figure. Fig. 9 (a)(b)(c) Fig. 9 (a) and Fig. 9 In the comparison with (c), it can be clearly felt that the generated image details are richer and more realistic, the feature boundaries are clearer, and the generated image quality is higher. Fig. 9 Most of the images generated by CycleGAN in (a) have defects such as broken wefts and loose threads. Fig. 9 In (b), the generated image of ECC-CycleGAN not only has two defects, broken weft and loose weft, but also has more defects such as zigzag, weft band and tight weft, which is more diverse. Fig. 9 (b) and Fig. 9(c) It can be seen that ECC-CycleGAN can generate defect images of corresponding shapes based on the manually calibrated defect feature contour map, and the positioning is relatively accurate, which proves that the model in this paper can control the defect contour features of the generated image. This model greatly improves the ability to generate cloth defect data, allowing uncommon or difficult to collect cloth defects to be generated with high quality. The expanded data set is also very helpful for the generalization and detection accuracy of the training target detection model.

[0082] Finally, it should be noted that the above examples are only some specific embodiments of the present invention. Obviously, the present invention is not limited to the above embodiments, and there are many variations. All variations that can be directly derived or associated with the content disclosed by a person skilled in the art should be considered as the protection scope of the present invention.

Claims

1. A method for generating cloth defect images based on an improved CycleGAN, characterized in that: The specific process includes collecting cloth surface images, cropping the collected cloth surface images in the host computer, and then inputting the selected cloth images with defects and random contour feature maps into the ECC-CycleGAN network to output fabric defect images corresponding to the shape of the contour feature map; The ECC-CycleGAN network is based on the CycleGAN network, and the discriminator of the CycleGAN network remains unchanged, and the original encoder of the generator is replaced by the CE encoder, and the original decoder is replaced by the C decoder.

2. According to claim 1, the method for generating cloth defect images by improving CycleGAN is characterized in that: The cropping process is to crop the original collected images into a group of small-sized images and select the cloth images with defects, and then each cloth image with defects corresponds to a random contour feature map of the same size.

3. The method for generating cloth defect images by improving CycleGAN according to claim 2, characterized in that: The CE encoder replaces the convolutions of the third to sixth layers of the encoder of the CycleGAN network generator with CoordConv modules, and adds an EMA attention module after the last convolution layer of the encoder.

4. The method for generating cloth defect images by improving CycleGAN according to claim 3, characterized in that: The C decoder replaces the first deconvolution of the decoder of the CycleGAN network generator with a CARAFE module.

5. The method for generating cloth defect images by improving CycleGAN according to claim 4, characterized in that: The training and testing process of the ECC-CycleGAN network is as follows: The cloth pictures are collected and divided into a training set and a test set after the cropping process; then the cloth defect images and feature contour maps in the training set are input into the ECC-CycleGAN network, and the generation ability of the generator and the discrimination ability of the discriminator are optimized by the adversarial loss function, so that the generation quality of the image is gradually improved, and part of the feature structure of the original image is retained by the cycle consistency loss function, and the training is completed after reaching a preset number of epochs; then the feature contour map and cloth defect images of the test set are input into the ECC-CycleGAN network to test and verify the model.

Citation Information

Patent Citations

  • Textile defect sample digital generation method based on generative adversarial network

    CN115482447A

  • Underwater image target detection method of novel DDCE-YOLOv8s model

    CN118247645A

  • Method and system for enhancing online reflected light ferrograph image

    US20230154158A1

  • Generating an inpainted image from a masked image using a patch-based encoder

    US20230351558A1

Cited By

  • Image generation method based on generative adversarial network

    CN120070647A

  • Low-signal-to-noise-ratio image reconstruction method and device, equipment and storage medium

    CN121074189A

  • Low-snr image reconstruction method, device, equipment and storage medium

    CN121074189B