Fabric defect image denoising method based on improved generative adversarial network

By improving the generative adversarial network, combining multi-scale discriminator, residual network and CBAM attention mechanism, the problem of noise damage during image acquisition and processing is solved, and the accuracy and robustness of fabric defect image denoising is improved. Simplifies the training process and reduces the dependence on manual adjustment parameters.

CN119048391AActive Publication Date: 2024-11-29ZHEJIANG SCI-TECH UNIV

Patent Information

Application Number
CN202411165889.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-11-29
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

The prior art is susceptible to noise damage during image acquisition, processing, compression, storage and transmission, which affects the accuracy and reliability of fabric defect detection. Traditional denoising methods rely on manual setting rules and have limited generalization capabilities, while deep learning Methods The calculation resources are consumed very much and have strong dependence on data.

Method used

Adopting an improved generative adversarial network, by introducing multi-scale discriminators, residual networks and CBAM attention mechanisms, combining perceptual loss, pixel loss, feature loss and SSIM loss, a new adaptive weight strategy for loss function is proposed to optimize model structure and training process to improve denoising performance.

Benefits of technology

Significantly improves the noise removal effect, enhances the accuracy and reliability of the defect detection system, reduces the dependence on manual adjustment parameters, simplifies the training process, improves the computing efficiency, and performs better in different noise and defect scenarios adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119048391A_ABST
    Figure CN119048391A_ABST
Patent Text Reader

Abstract

The invention provides a fabric defect image denoising method for improving a generative adversarial network, and relates to the technical field of computer vision and image processing. The method comprises the following steps: firstly, carrying out preliminary denoising on a noise fabric image by utilizing an improved residual network; then, a multi-scale discriminator is introduced to discriminate the quality of the denoised image so as to optimize training of the generation network; a generative adversarial network containing a CBAM attention mechanism is adopted to carry out further denoising and detail reservation on the fabric image; and finally, optimizing a loss function through an adaptive weight strategy, and improving the denoising performance and defect detection accuracy of the model. According to the method, the quality of the denoised fabric image is effectively improved, the capability of retaining details and defects is enhanced, and the adaptability and training efficiency of the generative adversarial network in different fabric defect detection tasks are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer vision and image processing, and in particular to a fabric defect image denoising method using an improved generative adversarial network. Background Art

[0002] Images are easily damaged by noise during the process of acquisition, processing, compression, storage, transmission and copying. The presence of noise not only reduces the quality of the image, but also directly affects the accuracy and reliability of subsequent defect detection. For common fabric defects such as spurs, broken spandex, flower board jumps, starch spots, holes, three-wire, flower jumps, weft shrinkage, stains, etc., the difficulty of detection is further magnified. These defects are often subtle and difficult to detect, highly similar in color to the fabric background, unevenly distributed, and blurred with normal texture features, making it difficult for the defect detection system to accurately identify and distinguish. In addition, the complex and changeable production environment of the factory also poses great challenges to the acquisition of fabric defect images. In order to improve the accuracy of the defect detection system and further lightweight the defect detection algorithm model, it is particularly important to denoise the fabric defect image.

[0003] Image denoising refers to the process of removing unwanted noise or artifacts from an image. It is an important task in image processing and computer vision. As a classic research topic in low-level visual tasks, image denoising technology can effectively improve the quality and clarity of fabric defect images if used properly, laying a solid foundation for subsequent fabric image defect detection tasks. Through appropriate denoising methods, the noise level in fabric defect images can be effectively reduced, the identifiability of defects can be enhanced, and the accuracy and reliability of fabric quality detection can be improved.

[0004] In recent years, the development of image denoising technology is mainly reflected in two aspects: traditional image denoising methods based on image models and image denoising methods based on deep learning.

[0005] Traditional image denoising methods based on image models rely on specific image models and prior knowledge to identify and extract image features, and use these features to eliminate noise. The advantage of traditional methods is that they are highly targeted at the types and characteristics of noise, and can guarantee the denoising effect to a certain extent. The limitation is that they rely too much on manually set rules in the identification and processing of noise, and cannot adapt well to complex environmental noise.

[0006] The image denoising method based on deep learning uses a deep neural network to train a large number of noisy and noise-free image pairs, so that the deep neural network can learn to automatically extract and process image features and denoise the image. The advantage of the image denoising method based on deep learning is that it can automatically obtain image features and has high generalization ability. At the same time, it builds a complete end-to-end system to simplify the denoising process. The limitation is that it consumes a lot of computing resources and has a high dependence on the quality and quantity of training data.

[0007] Generate adversarial networks (GANs), as a deep learning method, have the advantages of unsupervised learning, flexibility, adaptability and high-quality restoration in image denoising. Summary of the invention

[0008] In order to solve the technical problems that images in the prior art are easily damaged by noise during the collection, processing, compression, storage, transmission and copying processes, resulting in a decrease in image quality, which in turn affects the accuracy and reliability of fabric defect detection, especially the increased difficulty in detecting defects that are subtle and difficult to detect, have colors similar to the fabric background and are unevenly distributed, and that traditional denoising methods rely on manually set rules and have limited generalization capabilities, while deep learning denoising methods have the advantage of automatically extracting features but consume large computing resources and have strong data dependence, the present invention provides a fabric defect image denoising method using an improved generative adversarial network.

[0009] The technical solution provided by the present invention is as follows:

[0010] The present invention provides a fabric defect image denoising method using an improved generative adversarial network, comprising:

[0011] A fabric defect denoising model is generated using a generative adversarial network as a framework. The training network of the model includes a generator and two discriminators of different scales. The two discriminators work together to return the results to the generator to guide model training. The model determines the weight of the loss function by proposing a new loss function adaptive weight strategy to improve the denoising performance of the model. The model improves the network structure by introducing a multi-scale discriminator, a residual network and a CBAM attention mechanism module, so that the model can better retain fabric texture details and defect features. The model is trained to determine the optimal parameters, and finally the trained generator is used for fabric defect image denoising;

[0012] The loss function improves the target loss function by introducing perceptual loss, pixel loss, feature loss and SSIM loss. The improved target loss function is expressed as:

[0013] L total =α×w GAN LGAN +β×(w perceptual L perceptual +w pixel L pixel +w feat L feat +w ssim L ssim )

[0014] Among them, α, β, w GAN 、w perceptual 、w pixel 、w feat and w ssim Indicates the weight of each loss term in the target loss function, L GAN To combat the loss, L perceptual is the perceptual loss, L pixel is the pixel loss, L feat is the feature loss, L ssim is the structural similarity loss;

[0015] The loss function adaptive weight strategy is to achieve adaptive adjustment of the loss function weight by setting the inner layer gradient weight and the outer layer gradient weight. The inner layer gradient weight balances and optimizes the contribution of different loss items to the model by introducing the gradient descent method to determine the basic weight of each loss function. The mathematical expression of the gradient descent method is:

[0016]

[0017] Among them, w′ i Represents the adjusted i-th loss function L i The weight of α is used to adjust the amplitude of weight adjustment, which is 1. β is the bias term of weight adjustment, which is 0.1. represents the gradient of the i-th loss function with respect to the respective weight parameters,

[0018] After the inner layer gradient is determined, the outer layer gradient weight is dynamically adjusted to realize the change of the importance of different loss items as the training progresses. The mathematical expression of dynamically adjusting the outer layer gradient weight is:

[0019]

[0020] β=max(δ-α,0.1)

[0021] Among them, α and β are the outer gradient weights of adversarial loss and other loss outer gradient weights, γ and δ are outer gradient weight parameters, epochs and total_batches are the total number of training rounds and the total number of batches, epoch and bath_idx are the current number of training rounds and the current training batch, the inner gradient weights and the outer gradient weights cooperate with each other to guide the dynamic allocation of weights between different loss functions, so that the model can better distinguish the characteristics of noise and fabric defects, and is more robust to different types of noise and defects;

[0022] The multi-scale discriminator includes a discriminator D V and the discriminator D i , the discriminator D V It is used to evaluate and judge the original scale clear noise-free image and the denoised image. At the same time, the two images are input to the discriminator D after reducing the image resolution through downsampling operation i Evaluate and judge the image quality, and finally integrate the discriminator D V and the discriminator D i The output result is fed back to the generator;

[0023] The residual network simplifies the learning process of deep neural networks by adding residual blocks. The residual network includes two paths, namely, the residual branch F(x l , W l ) and direct mapping h(x l ), the residual branch includes a convolution layer, a batch normalization layer and a ReLU activation function in sequence, and then includes a convolution layer and a ReLU activation function. The direct mapping h(x l ) passes the input to the addition operation, and the residual branch F(x l , W l ) and the direct mapping h(x l ) is processed by the ReLU activation function through the element-by-element addition operation. The mathematical representation of the residual block is:

[0024] x l+1 =h(x l )+F(x l , W l )

[0025] Among them, x l+1 Represents the features after residual block processing, directly mapping h(x l ) is a skip connection, F(x l , W l ) represents the residual function, W l is the collection of learnable parameters;

[0026] The CBAM (Convolutional Block Attention Module) attention mechanism includes a mixture of a channel attention mechanism (CAM) and a spatial attention mechanism (SAM).

[0027] The beneficial effects brought about by the technical solution provided by the present invention include at least:

[0028] (1) In the present invention, by introducing a multi-scale discriminator, a residual network and a CBAM attention mechanism module, the structure of the generative adversarial network is significantly improved, so that the model can better retain the fabric texture details and defect features while removing fabric image noise, which improves the denoising effect, makes the model more robust in different types of noise and defect detection, and enhances the accuracy and reliability of the defect detection system;

[0029] (2) In the present invention, by proposing a new loss function adaptive weight strategy, the invention can dynamically adjust the weights of each item in the loss function and balance the contribution of different loss items to model training. This strategy effectively improves the denoising performance of the generative adversarial network, enables the model to more accurately distinguish between noise and defects, ensures the quality of the denoised image, and reduces the reliance on manually adjusted parameters;

[0030] (3) In the present invention, the designed dual-scale discriminator structure and the application of the residual network enable the model to converge faster during deep learning training, simplify the training process, and improve computational efficiency. In addition, the introduction of the CBAM attention mechanism further enhances the model's ability to focus on local details and overall texture, making the model more adaptable in different fabric defect scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0032] Figure 1 A schematic flow chart of a fabric defect image denoising method using an improved generative adversarial network provided in an embodiment of the present invention;

[0033] Figure 2 An overall framework diagram of a denoising model of a fabric defect image denoising method using an improved generative adversarial network provided in an embodiment of the present invention;

[0034] Figure 3 A loss function weight adaptive adjustment diagram of a fabric defect image denoising method using an improved generative adversarial network provided in an embodiment of the present invention;

[0035] Figure 4 A multi-scale discriminator structure diagram of a fabric defect image denoising method using an improved generative adversarial network provided in an embodiment of the present invention;

[0036] Figure 5 A CBAM structure diagram of a fabric defect image denoising method using an improved generative adversarial network provided in an embodiment of the present invention;

[0037] Figure 6 A residual network structural block diagram of a fabric defect image denoising method based on an improved generative adversarial network provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0038] The technical solution of the present invention is described below in conjunction with the accompanying drawings.

[0039] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "example" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "example" is intended to present the concept in a specific way. In addition, in the embodiments of the present invention, the meaning expressed by "and / or" can be both, or it can be either of the two.

[0040] In the embodiments of the present invention, "image" and "picture" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same. "of", "corresponding, relevant" and "corresponding" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same.

[0041] In the embodiments of the present invention, sometimes a subscript such as W1 may be mistakenly written as a non-subscript such as W1. When the difference is not emphasized, the meanings to be expressed are consistent.

[0042] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0043] Reference Manual Attached Figure 1 , showing a flow chart of a fabric defect image denoising method using an improved generative adversarial network provided in an embodiment of the present invention.

[0044] The embodiment of the present invention provides a fabric defect image denoising method using an improved generative adversarial network, and the processing flow may include the following steps:

[0045] The fabric defect image denoising model proposed in the embodiment of the present invention adopts a generative adversarial network as the basic framework. The overall architecture of the model is as follows: Figure 2 As shown in the figure, the training network mainly includes a generator and two discriminators of different scales. The two discriminators work together to return the results to the generator to guide model training. The model introduces perceptual loss, pixel loss, feature loss, SSIM loss, and proposes a new loss function adaptive weight strategy to determine the weight of the loss function to improve the denoising performance of the model. The network structure is improved by introducing multi-scale discriminators, residual networks, and CBAM attention mechanism modules, so that the model can better retain fabric texture details and defect features and improve the calculation speed of the network. The model is trained layer by layer to determine the optimal parameters, and finally the trained generator is used for fabric defect image denoising.

[0046] Specifically, in the loss function, a reasonable loss function can accurately quantify the difference between the denoised image and the clear image. The embodiment of the present invention integrates the perceptual loss, pixel loss, feature loss and SSIM loss. The improved loss function can effectively guide the generative adversarial network to better train the fabric defect image denoising model, retain the rich image details of the fabric texture, and improve the denoising quality of the fabric defect image. The target loss function for the future is expressed as:

[0047] L total =α×w GAN L GAN +β×(w perceptual L perceptual +w pixel L pixel +w feat L feat +w ssim L ssim )

[0048] Among them, α, β, w GAN 、w perceptual 、w pixel 、w feat and w ssim Indicates the weight of each loss term in the target loss function, L GAN To combat the loss, L perceptual is the perceptual loss, L pixel is the pixel loss, L feat is the feature loss, L ssim is the structural similarity loss.

[0049] Adversarial loss L GANAs the most basic loss function of the generative adversarial network, it is the core of the entire generative adversarial network model. The adversarial loss promotes the dynamic game between the generator and the discriminator, promotes the learning process of the entire model, builds an environment where the generator and the discriminator compete and cooperate, and achieves high-quality fabric defect image denoising tasks. The adversarial loss can be expressed mathematically as:

[0050]

[0051] Among them, D(x) is the true probability value of the input sample returned by the discriminator, and G(z) is the denoised image generated by the generator based on z. Indicates that in the true probability distribution p data (x) is the expected value of the sampling point x, Represents the expected value of the input noise probability distribution with respect to the noise vector z.

[0052] Perceptual loss L perceptual It focuses more on the structure and semantic content of the image rather than the exact value of each pixel. The embodiment of the present invention introduces perceptual loss to extract features using the pre-trained convolutional neural network VGG19, compares the difference between the denoised image and the clean image in the deep feature space to guide model learning, and further improves the denoising quality of the fabric defect image. The introduced perceptual loss can be expressed mathematically as:

[0053]

[0054] Among them, C, H and W represent the number of feature map channels, length and width pixel values, respectively, and F c,h,w represents the feature response at channel C and position (h, w), y represents the target noise-free image, Represents a denoised image.

[0055] Pixel loss L pixel Directly compare the similarity of the pixel values ​​of the denoised image and the clear image. Introducing pixel loss can ensure that the denoised fabric defect image is close to the noise-free clear image at the pixel level, thereby retaining the defect characteristics and texture details of the fabric. The embodiment of the present invention calculates the pixel loss by using the Euclidean distance (L2), which is mathematically expressed as:

[0056]

[0057] Where N is the total number of pixels in the image, x is the random noise input to the generator, and G(x) i and i Decibel is the value of the i-th pixel of the denoised fabric defect image and the clear image generated by the generator.

[0058] Feature loss L featIt is possible to directly extract the feature representation of the image and calculate the difference between these feature representations. The introduction of feature loss helps the model learn to distinguish between defects and background textures. Using the feature representation of the training network can also make the model better generalize to unseen fabric types and defects, improving the versatility of the denoising algorithm. The introduced feature loss is mathematically expressed as:

[0059]

[0060] Among them, G(x) is the denoised image, y is the clean noise-free image, M is the dimension of the feature vector, and ||·||1 is the absolute error loss (L1 norm), which can better maintain the realism of the fabric texture.

[0061] The main purpose of using the structural similarity index as a loss term is to measure image loss from the perspective of brightness, contrast, and structural changes to avoid over-smoothing of the image. The SSIM loss uses the fact that the SSIM index is positively correlated with image quality and uses the difference from the SIIM maximum value of 1 as a loss term to better guide the image to train and learn in the direction of high SSIM. The introduced SSIM loss is mathematically expressed as:

[0062] L ssim =1-SSIM

[0063] Among them, SSIM is the Structural Similarity Index.

[0064] Specifically, in the adaptive weight strategy, Figure 3 As shown, the adaptive weight strategy aims to dynamically adjust the weights among perceptual loss, pixel loss, feature loss, SSIM loss, etc. In the fabric defect denoising model, the adversarial loss requires a larger weight in the early stage of training to guide the generator to generate data close to the real world. As the training progresses, the perceptual, pixel, feature, and SSIM level losses may become more important. The embodiment of the present invention realizes the adaptive adjustment of the loss function weight by setting the inner layer gradient weight and the outer layer gradient weight.

[0065] The inner layer gradient weights balance and optimize the contribution of different loss items to the model by introducing the gradient descent method, determine the basic weights of each loss function, enable the model to flexibly respond to data changes in the fabric defect image training set, improve the model training speed, and simplify the model tuning process. The gradient descent method used is mathematically expressed as:

[0066]

[0067] Among them, w′ i Represents the adjusted i-th loss function L iThe weight of α is used to adjust the amplitude of weight adjustment, which is 1. β is the bias term of weight adjustment, which is 0.1. represents the gradient of the i-th loss function with respect to the respective weight parameters,

[0068] After the inner layer gradient is determined, the outer layer gradient weight is dynamically adjusted to realize the change of the importance of different loss items as the training progresses. The mathematical expression of dynamically adjusting the outer layer gradient weight is:

[0069]

[0070] β=max(δ-α,0.1)

[0071] Among them, α and β are the outer gradient weights of adversarial loss and other loss outer gradient weights, γ and δ are outer gradient weight parameters, epochs and total_batches are the total number of training rounds and the total number of batches, epoch and bath_idx are the current number of training rounds and the current training batch, respectively. The inner gradient weights and the outer gradient weights cooperate with each other to guide the dynamic allocation of weights between different loss functions, so that the model can better distinguish the characteristics of noise and fabric defects, and is more robust to different types of noise and defects.

[0072] Specifically, in the multi-scale discriminator, in order to obtain the global and local features of the learning image and make the discriminator output reflect the similarity between the overall and local features of the denoised image and the noise-free clear image, a multi-scale discriminator is introduced to downsample the denoised image and the noise-free clear image, so as to improve the learning ability of the generative adversarial network model for image features of different scales, more finely process the texture details and defects in the fabric image, evaluate the authenticity of the generated image from multiple resolution levels, and generate more realistic and detail-rich denoising results.

[0073] The multi-scale discriminator structure introduced in the embodiment of the present invention is as follows: Figure 4 As shown, the discriminator D v It is used to evaluate and judge the original scale clear noise-free image and the denoised image. At the same time, the two images are input to the discriminator D after reducing the image resolution through downsampling operation. i Evaluate and judge the image quality. Discriminator D v It has a smaller receptive field and can pay more attention to the local details and high-frequency information of the input image. i With a larger receptive field, it will pay more attention to the overall structure and large-scale texture of the input image. v and the discriminator D i The output results are fed back to the generator to guide the generator to better identify fabric noise and defects, remove noise more accurately and retain defects and texture features, thereby improving the denoising performance of the network.

[0074] Specifically, the structure of the CBAM attention mechanism is as follows Figure 5 As shown in the figure, CBAM (Convolutional Block Attention Module) is a mixture of Channel Attention Mechanism (CAM) and Spatial Attention Mechanism (SAM). It dynamically adjusts the importance of features through channel and spatial dimensions, enhances the focusing ability and learning efficiency of the denoising model, and improves the denoising performance of the model. Adding the CBAM module to the generator enables the model to automatically identify and enhance the feature channels and spatial positions of fabric defects, further distinguish fabric texture, defects and noise, avoid eliminating important information such as defects and textures during the denoising process, and help the network learn more discriminative feature representations.

[0075] Specifically, Figure 6 As shown in the figure, the residual network simplifies the learning process of the deep neural network by adding residual blocks, thereby successfully training a very deep network structure. The introduction of the residual network enables the generator to better capture the characteristics of different types of fabric defects, integrate this information through jump connections, improve the model's adaptability to diverse defects, and generate clearer and more realistic fabric images. Although the introduction of the residual network increases the complexity of the model, due to its good optimization characteristics, it can actually accelerate the convergence process and reduce the training time and computing resources required to achieve the denoising effect.

[0076] Among them, weight represents the unit addition operation; addition represents the unit convolution operation; BN represents the batch normalization layer. The entire residual network structure consists of two paths: the residual branch F(x l , W l ) and direct mapping h(x l ). The residual block is mathematically represented as:

[0077] x l+1 =h(x l )+F(x l , W l )

[0078] Among them, x l+1 Represents the features after residual block processing, directly mapping h(x l ) is a skip connection, F(x l , W l ) represents the residual function, W l It is a collection of learnable parameters such as convolution kernel weights and bias terms.

[0079] The embodiment of the present invention also provides evaluation indicators for evaluating the present method, and the evaluation indicators include peak signal-to-noise ratio (PSNR) and similarity structural index (SSIM). The peak signal-to-noise ratio measures the ratio of signal strength and noise level in an image based on the mean square error, in decibels (dB). The peak signal-to-noise ratio focuses on pixel-level errors, does not consider image structure and visual fidelity, but can highlight small details of the image. The higher the peak signal-to-noise ratio, the smaller the distortion of the denoised image and the higher the denoising quality. The calculation method of the peak signal-to-noise ratio is:

[0080]

[0081] Among them, MAX I is the maximum possible value of the image pixel, and MSE is the mean square error.

[0082] The similarity structural index measures the similarity between the denoised image and the noise-free image by simulating the characteristics of the human visual system, taking into full account the brightness, contrast and structural information of the image. A higher similarity structural index value (close to 1) indicates that the denoised image maintains the visual quality of the image while satisfying the denoising effect. For fabric defect denoised images, which are more sensitive to changes in image structure and texture, the similarity structural index can more accurately give the perceived quality index of the image. The calculation method of similarity structural is:

[0083]

[0084] Among them, x and y represent the noise-free image and the denoised image respectively, μ x and μ x are the average brightness of the two images, and are the variances of the two images, respectively, used to reflect the contrast of the images, σ xy is the covariance of the two images, which measures the similarity of structural information. c1 and c2 are constant terms used to stabilize the denominator.

[0085] It should be noted that in determining the weight of the loss function, in order to determine the optimal weight of the loss function in the model training network, the weight of each loss function is divided into two parts: the inner gradient weight and the outer gradient weight. Among them, the inner gradient weight is used to determine the specific weight of each loss function in each iteration of the model. The outer gradient weight is used to control the importance of each loss function of the model as the number of iterations of the training network increases.

[0086] The embodiment of the present invention proposes a fabric defect image denoising method based on an improved generative adversarial network. The loss function is improved on the basis of the original network, the fabric defect image denoising effect is enhanced, the fabric defects are better highlighted and the fabric texture details are retained. In order to make the loss function guide the network training more efficiently, a loss function adaptive weight strategy is proposed, and the effectiveness of the adaptive weight strategy is proved by experiments. The versatility and robustness of the algorithm on a variety of fabric defect images are improved. In terms of network structure, a multi-scale discriminator, residual connection, and CBAM attention module are introduced to improve the denoising ability of the model. The model proposed in the embodiment of the present invention is strictly verified under various noise conditions, and quantitative indicators are used to determine the denoising effect of the fabric defect image. The experimental results show that the method proposed in the embodiment of the present invention has a significant improvement in subjective visual effects and objective evaluation indicators compared with other image denoising methods, has strong practical value, and can provide strong support and guarantee for subsequent fabric defect detection tasks.

[0087] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:

[0088] (1) In the present invention, by introducing a multi-scale discriminator, a residual network and a CBAM attention mechanism module, the structure of the generative adversarial network is significantly improved, so that the model can better retain the fabric texture details and defect features while removing fabric image noise, which improves the denoising effect, makes the model more robust in different types of noise and defect detection, and enhances the accuracy and reliability of the defect detection system;

[0089] (2) In the present invention, by proposing a new loss function adaptive weight strategy, the invention can dynamically adjust the weights of each item in the loss function and balance the contribution of different loss items to model training. This strategy effectively improves the denoising performance of the generative adversarial network, enables the model to more accurately distinguish between noise and defects, ensures the quality of the denoised image, and reduces the reliance on manually adjusted parameters;

[0090] (3) In the present invention, the designed dual-scale discriminator structure and the application of the residual network enable the model to converge faster during deep learning training, simplify the training process, and improve computational efficiency. In addition, the introduction of the CBAM attention mechanism further enhances the model's ability to focus on local details and overall texture, making the model more adaptable in different fabric defect scenarios.

[0091] The above contents are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

[0092] There are a few points to note:

[0093] (1) The drawings of the embodiments of the present invention only relate to the structures related to the embodiments of the present invention, and other structures may refer to the general design.

[0094] (2) For the sake of clarity, in the drawings used to describe the embodiments of the present invention, the thickness of the layers or regions is exaggerated or reduced, that is, these drawings are not drawn according to the actual scale. It is understood that when an element such as a layer, film, region or substrate is referred to as being "on" or "under" another element, the element may be "directly" "on" or "under" the other element or there may be intermediate elements.

[0095] (3) In the absence of conflict, the embodiments of the present invention and the features therein may be combined with each other to obtain new embodiments.

[0096] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. The protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A fabric defect image denoising method based on an improved generative adversarial network, characterized in that: include: A fabric defect denoising model is generated using a generative adversarial network as a framework. The training network of the model includes a generator and two discriminators of different scales. The two discriminators work together to return the results to the generator to guide model training. The model determines the weight of the loss function by proposing a new loss function adaptive weight strategy to improve the denoising performance of the model. The model improves the network structure by introducing a multi-scale discriminator, a residual network and a CBAM attention mechanism module, so that the model can better retain fabric texture details and defect features. The model is trained to determine the optimal parameters, and finally the trained generator is used for fabric defect image denoising; The loss function improves the target loss function by introducing perceptual loss, pixel loss, feature loss and SSIM loss. The improved target loss function is expressed as: L total =α×w GAN L GAN +β×(w perceptual L perceptual +w pixel L pixel +w feat L feat +w ssim L ssim ) Among them, α, β, w GAN 、w perceptual 、w pixel 、w feat and w ssim Indicates the weight of each loss term in the target loss function, L GAN To combat the loss, L perceptual is the perceptual loss, L pixel is the pixel loss, L feat is the feature loss, L ssim is the structural similarity loss; The loss function adaptive weight strategy is to achieve adaptive adjustment of the loss function weight by setting the inner layer gradient weight and the outer layer gradient weight. The inner layer gradient weight balances and optimizes the contribution of different loss items to the model by introducing the gradient descent method to determine the basic weight of each loss function. The mathematical expression of the gradient descent method is: Among them, w' i Represents the adjusted i-th loss function L i The weight of α is used to adjust the amplitude of weight adjustment, which is 1. β is the bias term of weight adjustment, which is 0.

1. represents the gradient of the i-th loss function with respect to the respective weight parameters, After the inner layer gradient is determined, the outer layer gradient weight is dynamically adjusted to realize the change of the importance of different loss items as the training progresses. The mathematical expression of dynamically adjusting the outer layer gradient weight is: β=max(δ-α,0.1) Among them, α and β are the outer gradient weights of adversarial loss and other loss outer gradient weights, γ and δ are outer gradient weight parameters, epochs and total_batches are the total number of training rounds and the total number of batches, epoch and bath_idx are the current number of training rounds and the current training batch, the inner gradient weights and the outer gradient weights cooperate with each other to guide the dynamic allocation of weights between different loss functions, so that the model can better distinguish the characteristics of noise and fabric defects, and is more robust to different types of noise and defects; The multi-scale discriminator includes a discriminator D V and the discriminator D i , the discriminator D V It is used to evaluate and judge the original scale clear noise-free image and the denoised image. At the same time, the two images are input to the discriminator D after reducing the image resolution through downsampling operation i Evaluate and judge the image quality, and finally integrate the discriminator D V and the discriminator D i The output result is fed back to the generator; The residual network simplifies the learning process of deep neural networks by adding residual blocks. The residual network includes two paths, namely, the residual branch F(x l ,W l ) and direct mapping h(x l ), the residual branch includes a convolution layer, a batch normalization layer and a ReLU activation function in sequence, and then includes a convolution layer and a ReLU activation function. The direct mapping h(x l ) passes the input to the addition operation, and the residual branch F(x l ,W l ) and the direct mapping h(x l ) is processed by the ReLU activation function through the element-by-element addition operation. The mathematical representation of the residual block is: x l+1 =h(x l )+F(x l ,W l ) Among them, x l+1 Represents the features after residual block processing, directly mapping h(x l ) is a skip connection, F(x l ,W l ) represents the residual function, W l is the collection of learnable parameters; The CBAM (Convolutional Block Attention Module) attention mechanism includes a mixture of a channel attention mechanism (CAM) and a spatial attention mechanism (SAM).

2. The fabric defect image denoising method based on an improved generative adversarial network according to claim 1, characterized in that: include: The adversarial loss L GAN The mathematical representation of is: Among them, D(x) is the true probability value of the input sample returned by the discriminator, and G(z) is the denoised image generated by the generator based on z. Indicates that in the true probability distribution p data (x) is the expected value of the sampling point x, Represents the expected value of the input noise probability distribution with respect to the noise vector z.

3. The fabric defect image denoising method based on an improved generative adversarial network according to claim 1, characterized in that: include: The perceptual loss L perceptual The mathematical representation of is: Among them, C, H and W represent the number of feature map channels, length and width pixel values, respectively, and F c,h,w represents the feature response at channel C and position (h, w), y represents the target noise-free image, Represents a denoised image.

4. The fabric defect image denoising method based on an improved generative adversarial network according to claim 1, characterized in that: include: The pixel loss L pixel The pixel loss is calculated by Euclidean distance (L2), which is mathematically expressed as: Where N is the total number of pixels in the image, x is the random noise input to the generator, and G(x) i and i Decibel is the value of the i-th pixel of the denoised fabric defect image and the clear image generated by the generator.

5. The fabric defect image denoising method based on improved generative adversarial network according to claim 1, characterized in that: include: The feature loss L feat The mathematical representation of is: Among them, G(x) is the denoised image, y is the clean noise-free image, M is the dimension of the feature vector, and ||·||1 is the absolute error loss (L1 norm), which can better maintain the realism of the fabric texture.

6. The fabric defect image denoising method based on improved generative adversarial network according to claim 1, characterized in that: include: The structural similarity loss L ssim The mathematical representation of is: L ssim =1-SSIM Among them, SSIM is the Structural Similarity Index.

7. The fabric defect image denoising method based on improved generative adversarial network according to claim 1, characterized in that: include: The discriminator D V It has a smaller receptive field and pays more attention to the local details and high-frequency information of the input image; the discriminator D i It has a larger receptive field and pays more attention to the overall structure and large-scale texture of the input image.

8. The fabric defect image denoising method based on improved generative adversarial network according to claim 1, characterized in that: include: The learnable parameters include convolution kernel weights and bias terms.

Citation Information

Patent Citations

  • Multi-scale and multi-feature fusion feature pyramid network blind restoration method

    CN112509001A

  • Remote sensing image super-resolution reconstruction method based on lightweight generative model

    CN113538234A

  • Textile defect sample generation method based on generative adversarial network

    CN115482431A

  • Medical image segmentation method fusing multi-scale residual attention

    CN116563204A

  • Texture preserving low-dose CT image denoising based on texture feature guidance

    CN116596785A

Cited By

  • Multi-temporal remote sensing image cloud removal method based on global perception selective fusion

    CN119887589A

  • Textile color difference online detection method based on deep learning

    CN120997215A

  • A Deep Learning-Based Online Color Difference Detection Method for Textiles

    CN120997215B

  • Interactive multi-parameter fabric texture generation method and system

    CN121353287A

  • An interactive multi-parameter fabric texture generation method and system

    CN121353287B