Industrial defect sample generation method and system based on generative adversarial network

Through adversarial generative networks and defect enhancement algorithms, high-definition and highly diverse industrial defect samples are generated, which solves the problems of fuzzy sample data details and long training time in existing technologies and achieves efficient sample generation.

CN115661062BActive Publication Date: 2025-10-03NINGBO INST OF TECH ZHEJIANG UNIV ZHEJIANG
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211277842.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-19
Publication Date
2025-10-03
Estimated Expiration
2042-10-19

AI Technical Summary

Technical Problem

In the existing technology, the defect details of industrial defect sample data generated by generative adversarial networks are relatively vague, which makes it difficult to meet the training requirements of deep learning models. In addition, the training process is time-consuming and the number of samples is limited.

Method used

A generative adversarial network is used to enhance the defect details of the sample data through a defect enhancement algorithm. Combined with the alternating training of the generator and the discriminator, high-definition and highly diverse industrial defect samples are generated.

Benefits of technology

The generated sample data has high clarity and high diversity, which reduces training time, increases the number of samples, and meets the training requirements of deep learning models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115661062B_ABST
    Figure CN115661062B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of deep learning technology and discloses a method for generating industrial defect samples based on a generative adversarial network, comprising: constructing a generative adversarial network, wherein the generative adversarial network includes at least one generator network and at least one discriminator network; generating random noise z, generating a pseudo defect image G(z) through the generator with the generated random noise z, and performing defect enhancement on the pseudo defect image G(z) and the real defect image x using a defect enhancement algorithm to obtain an image y. f and y′ f ; Image y after defect enhancement f and y′ f The discriminator network is trained to distinguish between genuine and fake defect images; the generator network is updated to prevent it from distinguishing between genuine and fake defect images, generating industrial defect samples. The defect enhancement algorithm enhances the defect details in the sample data, generating high-definition and highly diverse samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of deep learning sample generation, and specifically relates to a method and system for generating industrial defect samples based on a generative adversarial network. Background Art

[0002] In industrial production and daily life, almost all products require quality inspection. A large part of the quality inspection process is completed by quality inspectors using the naked eye to detect product defects (hereinafter referred to as visual inspection), especially some surface defects, such as decorative panels, metal surfaces, keyboard surfaces, etc. This situation is very common in actual industry. Due to the diversity of products and defects, such as sewage pipe defects with stains, rust, and inconvenient detection, the workload and difficulty of quality inspectors are greatly increased, resulting in a decrease in the efficiency of manual visual inspection and the susceptibility to missed inspections and incorrect inspections due to fatigue and mistakes of quality inspectors. With the development of deep learning technology, industrial defect detection technology based on deep learning has been widely used in the field of defect detection.

[0003] The essence of deep learning is to learn features by building machine learning models with multiple hidden layers and massive amounts of training data, ultimately improving the accuracy and versatility of classification or prediction. However, training an effective deep learning model requires a large amount of labeled data, extensive graphics card resources, and lengthy training times. In many industrial scenarios, the acquisition cost of defect images is very high, resulting in a very limited sample size, making it difficult to directly train deep learning models. Currently, generative adversarial networks can be used to generate specific target sample data. However, the defect details of sample data generated by classic generative adversarial networks are relatively vague, making them difficult to meet training requirements.

[0004] Publication No. CN 111127454 A discloses a method for generating industrial defect samples based on deep learning. The method involves collecting images of industrial defective products and annotating them with defect information. A deep adversarial generative model is constructed. Based on the annotated defect information, adversarial training is performed on the deep adversarial model to obtain defect samples. The defect samples are then screened to remove those that do not meet the predefined criteria, resulting in industrial defect samples. This method can highlight defect features and improve fine structure quality to a certain extent, but the defect detail of the resulting sample data still needs to be improved. Summary of the Invention

[0005] In response to the above-mentioned technical problems, the purpose of the present invention is to provide an industrial defect sample generation method and system based on a generative adversarial network. The defect enhancement algorithm can enhance the defect details of the sample data and generate samples with high clarity and high diversity.

[0006] The technical solution of the present invention is:

[0007] A method for generating industrial defect samples based on a generative adversarial network includes the following steps:

[0008] S01: Constructing a generative adversarial network, wherein the generative adversarial network includes at least one generator network and at least one discriminator network;

[0009] S02: Generate random noise z, pass the generated random noise z through the generator to generate a pseudo defect image G(z), and use the defect enhancement algorithm to enhance the pseudo defect image G(z) and the real defect image x to obtain image y f and y′ f ;

[0010] S03: Image y after defect enhancement f and y′ f Train the discriminator network to distinguish between real and fake defect images;

[0011] S04: Update the generator network so that it cannot distinguish the authenticity of defect images and obtain industrial defect samples.

[0012] In the preferred technical solution, the defect enhancement algorithm in step S02 includes:

[0013] The pseudo-defect image and the real defect image are converted from the spatial domain to the frequency domain through Fourier transform;

[0014] Filter the image data through a bandpass filter to amplify the defect features;

[0015] Use inverse Fourier transform to convert the image into spatial domain.

[0016] In a preferred technical solution, the generator network includes one or more fully connected layers and one or more convolutional blocks;

[0017] The fully connected layer maps the uniform probability distribution or Gaussian distribution into a specific distribution and generates an industrial defect image with a resolution that is relatively consistent with the first setting range;

[0018] Each convolution block includes one or more convolution layers and an upsampling operation, which adds the input industrial defect image with a resolution that is relatively consistent with the first setting range and the noise to generate an industrial defect image with a resolution that is consistent with the second setting range and enriches the semantic content on it;

[0019] The obtained uniform probability distribution or Gaussian distribution is mapped into high-definition images of industrial defects by the generator network.

[0020] In a preferred technical solution, the discriminator network includes one or more convolution blocks, each convolution block includes one or more convolution layers, which are used to distinguish between real defect images and pseudo defect images generated by the generator network.

[0021] In the preferred technical solution, the discriminator network and the generator network are trained in an alternating training manner, and the objective function is as follows:

[0022]

[0023] in, It means sampling the real data distribution and then finding the expectation of the function logD(x). represents sampling from Gaussian noise and finding the expectation of log(1-D(G(z)), represents the objective function to achieve generator optimization, It represents the optimization of the discriminator by maximizing the objective function.

[0024] In a preferred technical solution, the method for alternating training of the discriminator network and the generator network includes:

[0025] S30: Fix the generator network parameters and perform discriminator optimization k times. The discriminator optimization includes:

[0026] S31: From the prior distribution p (z) Randomly generate m random noise vectors z;

[0027] S32: Distribution of p from dataset (x) Here, m real defect images x are randomly obtained;

[0028] S33: Input the data-augmented real defect image into the discriminator network D. When calculating the loss function of the discriminator network, the label is set to true, and then the discriminator network is updated using the backpropagation algorithm.

[0029] S34: Input the generated pseudo-defect image into the discriminator network D, set the label to false when calculating the loss function of the discriminator network, and then update the discriminator network using the backpropagation algorithm;

[0030] S35: Use stochastic gradient ascent to optimize the discriminator cost function:

[0031]

[0032] Maximize the cost function;

[0033] in, Represents the gradient of the corresponding discriminator parameters, i represents the i-th random noise vector;

[0034] S40: After updating the discriminator network k times, update the generator once, including the following steps:

[0035] S41: From the prior distribution p (z) Randomly generate m random noise vectors z;

[0036] S42: Optimize the cost function of the generator using stochastic gradient descent:

[0037]

[0038] Minimize the cost function;

[0039] in, represents the parameter gradient of the generator G.

[0040] The present invention further discloses a computer storage medium on which a computer program is stored. When the computer program is executed, the above-mentioned industrial defect sample generation method based on the adversarial generative network is implemented.

[0041] The present invention also discloses an industrial defect sample generation system based on a generative adversarial network, comprising:

[0042] A generative adversarial network building module is used to build a generative adversarial network, wherein the generative adversarial network includes at least one generator network and at least one discriminator network;

[0043] The defect enhancement module generates random noise z, and generates a pseudo defect image G(z) through the generator. The pseudo defect image G(z) and the real defect image x are enhanced by the defect enhancement algorithm to obtain the image y. f and y′ f ;

[0044] The discriminator network training module uses the defect-enhanced image y f and y′ f Train the discriminator network to distinguish between real and fake defect images;

[0045] The generator network update module updates the generator network so that it cannot distinguish the authenticity of defect images and obtains industrial defect samples.

[0046] In the preferred technical solution, the defect enhancement algorithm includes:

[0047] The pseudo-defect image and the real defect image are converted from the spatial domain to the frequency domain through Fourier transform;

[0048] Filter the image data through a bandpass filter to amplify the defect features;

[0049] Use inverse Fourier transform to convert the image into spatial domain.

[0050] In the preferred technical solution, the discriminator network and the generator network are trained in an alternating training manner, and the objective function is as follows:

[0051]

[0052] in, It means sampling the real data distribution and then finding the expectation of the function logD(x). represents sampling from Gaussian noise and finding the expectation of log(1-D(G(z)), represents the objective function to achieve generator optimization, It represents the optimization of the discriminator by maximizing the objective function.

[0053] Compared with the prior art, the present invention has the following beneficial effects:

[0054] 1. The defect enhancement algorithm can enhance the defect details of the sample data and generate samples with high clarity and high diversity.

[0055] 2. The discriminator and generator networks are trained alternately to reduce training time. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The present invention will be further described below with reference to the accompanying drawings and embodiments:

[0057] Figure 1 This is a flowchart of the method for generating industrial defect samples based on a generative adversarial network in this embodiment;

[0058] Figure 2 This is a principle block diagram of the industrial defect sample generation system based on the adversarial generative network in this embodiment;

[0059] Figure 3 This is a workflow diagram of the industrial defect sample generation system based on the adversarial generative network in this embodiment;

[0060] Figure 4 Schematic diagram of the overall optimization process of the adversarial generative network in this embodiment. DETAILED DESCRIPTION

[0061] To make the objectives, technical solutions, and advantages of the present invention more clearly understood, the present invention will be further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings. It should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present invention.

[0062] Example

[0063] like Figure 1As shown, a method for generating industrial defect samples based on a generative adversarial network includes the following steps:

[0064] S01: Constructing a generative adversarial network, wherein the generative adversarial network includes at least one generator network and at least one discriminator network;

[0065] S02: Generate random noise z, pass the generated random noise z through the generator to generate a pseudo defect image G(z), and use the defect enhancement algorithm to enhance the pseudo defect image G(z) and the real defect image x to obtain image y f and y′ f ;

[0066] S03: Image y after defect enhancement f and y′ f Train the discriminator network to distinguish between real and fake defect images;

[0067] S04: Update the generator network so that it cannot distinguish the authenticity of defect images and obtain industrial defect samples.

[0068] In a preferred embodiment, the defect enhancement algorithm in step S02 includes:

[0069] The pseudo-defect image and the real defect image are converted from the spatial domain to the frequency domain through Fourier transform;

[0070] Filter the image data through a bandpass filter to amplify the defect features;

[0071] Use inverse Fourier transform to convert the image into spatial domain.

[0072] In a preferred embodiment, the generator network includes one or more fully connected layers and one or more convolutional blocks;

[0073] The fully connected layer maps the uniform probability distribution or Gaussian distribution into a specific distribution and generates an industrial defect image with a resolution that is relatively consistent with the first setting range;

[0074] Each convolution block includes one or more convolution layers and an upsampling operation, which adds the input industrial defect image with a resolution that is relatively consistent with the first setting range and the noise to generate an industrial defect image with a resolution that is consistent with the second setting range and enriches the semantic content on it;

[0075] The obtained uniform probability distribution or Gaussian distribution is mapped into high-definition images of industrial defects by the generator network.

[0076] The discriminator network includes one or more convolutional blocks, each of which includes one or more convolutional layers, which are used to distinguish between real defect images and fake defect images generated by the generator network.

[0077] In a preferred embodiment, the discriminator network and the generator network are trained in an alternating training manner, and the objective function is as follows:

[0078]

[0079] in, It means sampling the real data distribution and then finding the expectation of the function logD(x). represents sampling from Gaussian noise and finding the expectation of log(1-D(G(z)), represents the objective function to achieve generator optimization, It represents the optimization of the discriminator by maximizing the objective function.

[0080] In a preferred technical solution, the method for alternating training of the discriminator network and the generator network includes:

[0081] S30: Fix the generator network parameters and perform discriminator optimization k times. The discriminator optimization includes:

[0082] S31: From the prior distribution p (z) Randomly generate m random noise vectors z;

[0083] S32: Distribution of p from dataset (x) Here, m real defect images x are randomly obtained;

[0084] S33: Input the data-augmented real defect image into the discriminator network D. When calculating the loss function of the discriminator network, the label is set to true, and then the discriminator network is updated using the backpropagation algorithm.

[0085] S34: Input the generated pseudo-defect image into the discriminator network D, set the label to false when calculating the loss function of the discriminator network, and then update the discriminator network using the backpropagation algorithm;

[0086] S35: Use stochastic gradient ascent to optimize the discriminator cost function:

[0087]

[0088] Maximize the cost function;

[0089] in, Represents the gradient of the corresponding discriminator parameters, i represents the i-th random noise vector;

[0090] S40: After updating the discriminator network k times, update the generator once, including the following steps:

[0091] S41: From the prior distribution p (z) Randomly generate m random noise vectors z;

[0092] S42: Optimize the cost function of the generator using stochastic gradient descent:

[0093]

[0094] Minimize the cost function;

[0095] in, represents the parameter gradient of the generator G.

[0096] This process will update the parameters of the generator G to make the generated results of G(z) as realistic as possible, that is, D(G(z (i) )))The closer to 1, the better, so the corresponding log(1-D(G(z (i) ))) will be minimized, thereby minimizing the cost function.

[0097] In summary, by maximizing the value function to optimize the discriminator and minimizing the cost function to optimize the generator, after continuous alternating training, the data generated by the generative model is consistent with the real sample, and the discriminator D cannot accurately divide it, that is, (The probability that the discriminator determines whether any sample x is a true sample is 0.5).

[0098] In another embodiment, a computer storage medium stores a computer program thereon, wherein when the computer program is executed, the above-mentioned method for generating industrial defect samples based on a generative adversarial network is implemented.

[0099] In another embodiment, if Figure 2 As shown, a system for generating industrial defect samples based on a generative adversarial network is characterized by comprising:

[0100] A generative adversarial network construction module 10 is configured to construct a generative adversarial network, wherein the generative adversarial network includes at least one generator network and at least one discriminator network;

[0101] The defect enhancement module 20 generates random noise z, generates a pseudo defect image G(z) through the generator, and performs defect enhancement on the pseudo defect image G(z) and the real defect image x through the defect enhancement algorithm to obtain the image y. f and y′ f ;

[0102] The discriminator network training module 30 uses the defect-enhanced image y f and y′ f Train the discriminator network to distinguish between real and fake defect images;

[0103] The generator network updating module 40 updates the generator network so that it cannot distinguish the authenticity of the defect image and obtains the industrial defect sample.

[0104] The following takes underground pipeline defect detection as an example to explain in detail the workflow of the industrial defect sample generation system based on the adversarial generative network. Figure 3 As shown, the following steps are included:

[0105] Construct a generative adversarial network, which consists of a generator network and a discriminator network.

[0106] The generator network includes one or more fully connected layers and one or more convolution blocks. The fully connected layer maps the uniform probability distribution (or Gaussian distribution, etc.) into a specific distribution and generates a low-resolution image of industrial defects. Each convolution block includes one or more convolution layers and an upsampling operation, which can add the low-resolution image and noise input to generate a higher-resolution image and enrich its semantic content. Ultimately, the uniform probability distribution (or Gaussian distribution, etc.) is mapped by the generator network into a high-definition image of industrial defects.

[0107] The discriminator network consists of one or more convolutional blocks. Each convolutional block includes one or more convolutional layers. Their function is to gradually reduce the probability that the input image is a real defect image or a defect image generated by the generator network.

[0108] like Figure 3 As shown, z is a random noise extracted from the Gaussian distribution. The generator generates a pseudo defect image G(z). The defect enhancement algorithm is used to enhance the pseudo defect image G(z) and the real defect image x to obtain the image y. f and y′ f .

[0109] Specifically, the defect image and the true image are converted from the spatial domain to the frequency domain using a Fourier transform. A bandpass filter is then constructed to filter the image data. The frequency components obtained through bandpass filtering significantly suppress background textures and highlight defect components. Finally, an inverse Fourier transform is used to convert the image to the spatial domain for image enhancement.

[0110] Specifically, the method for constructing a bandpass filter includes:

[0111] Subtract two Gaussian filters to obtain a bandpass filter.

[0112] After image enhancement is completed, the defect-enhanced image y f and y′ fTrain the discriminator to distinguish real and fake images as closely as possible. After updating the discriminator k times in a loop, update the generator once, making it as difficult for the discriminator to distinguish real and fake images as possible.

[0113] like Figure 4 As shown, the discriminator network and the generator network are trained in an alternating manner, and the objective function is as follows:

[0114]

[0115] It means sampling the real data distribution and then finding the expectation of the function logD(x). It means sampling from Gaussian noise and finding the expectation of log(1-D(G(z)).

[0116] The above objective function optimization update is achieved by alternately iteratively optimizing the discriminator, i.e. the generator, in the following way:

[0117] Minimizing the objective function realizes generator optimization, maximizing the objective function realizes discriminator optimization, that is, it contains a minimization generator cost function And maximize the discriminator cost function process.

[0118] The generator's optimization and updating aims to mimic, model, and learn the distribution patterns of real data; the discriminator, on the other hand, determines whether the input data originates from the real data distribution or from the generator. Through continuous competition between these two internal models, both models' generative and discriminative capabilities are improved. When training is complete, the data generated by the generator confuses the discriminator, preventing it from making accurate judgments. This indicates that the generative model has learned the distribution of real data.

[0119] After continuous alternating training, the discriminant network cannot distinguish between real images and generated images.

[0120] The discriminator and generator networks are trained alternately:

[0121] 1. Execute D-step optimization K times

[0122] For a set of images as input (including the generated image y f and the true graph y′ f ), first train the discriminator, at this time the generator model parameters are fixed. The purpose of training is to make the discriminator model have the ability to distinguish whether the input image is a real image or an image generated by the generator. The training process is as follows:

[0123] 1) From the prior distribution p (z) Randomly generate m random noise vectors z;

[0124] 2) Distribution p from the dataset (x) Here, m real defect images x are randomly obtained;

[0125] 3) The real graph y′ after data enhancement f Input to the discriminator network D. At this time, when calculating the loss function of the discriminator network, the label should be true, and then the discriminator network is updated by the backpropagation algorithm.

[0126] 4) Input the generated graph into the discriminator network D. At this time, when calculating the discriminator network loss function, the label should be set to false, and the discriminator network is updated in the same way using the backpropagation algorithm.

[0127] 5) Use stochastic gradient ascent to optimize the discriminator’s cost function:

[0128]

[0129] Denotes the gradient of the corresponding discriminator parameters, i denotes the i-th random noise vector. D(G(z)) denotes the probability that the discriminator considers the generated image G(z) to be a real image.

[0130] This process will update the parameters of the discriminator D, improve the discriminator's ability to distinguish, and accurately determine whether the input sample is real data or generated data. That is, when the discriminator input is the distribution of the real image x, the discriminator generates the probability D(x (i) ) is closer to 1, the better, the corresponding D(G(z (i) The closer )) is to 0, the better, thus maximizing the cost function. This process corresponds to the objective function (Formula 1) in

[0131] 2. Perform G-step minibatch optimization once:

[0132] 1) Fix the parameters of the discriminator D and randomly generate the noise vector z;

[0133] 2) Use stochastic gradient descent to optimize the cost function of the generator:

[0134]

[0135] represents the parameter gradient of the generator G.

[0136] This process will update the parameters of the generator G to make the generated results of G(z) as realistic as possible, that is, D(G(z (i) )))The closer to 1, the better, so the corresponding log(1-D(G(z (i) ))) will be minimized, thereby minimizing the cost function, which corresponds to the objective function (Formula 1)

[0137] In summary, by maximizing the value function to optimize the discriminator and minimizing the cost function to optimize the generator, after continuous alternating training, the data generated by the generative model is consistent with the real sample, and the discriminator D cannot accurately divide it, that is, (The probability that the discriminator determines whether any sample x is a true sample is 0.5).

[0138] After multiple iterations, ideally, the discriminator D is unable to distinguish whether an image comes from the real training sample set or from a sample generated by the generator G, thus making the defect images generated by the model more similar to real images. Finally, the data generated by the adversarial network is mixed with real data in a uniform distribution and fed into the convolutional neural network as training samples for model training, achieving defect classification and discrimination.

[0139] It should be understood that the above-described specific embodiments of the present invention are merely illustrative or illustrative of the principles of the present invention and do not constitute limitations of the present invention. Therefore, any modifications, equivalent substitutions, improvements, etc. made without departing from the spirit and scope of the present invention should be included within the scope of protection of the present invention. In addition, the appended claims are intended to cover all variations and modifications that fall within the scope and metes and bounds of the appended claims, or equivalents thereof.

Claims

1. A method for generating industrial defect samples based on a generative adversarial network, characterized in that: The following steps are involved: S01: Constructing a generative adversarial network, wherein the generative adversarial network includes at least one generator network and at least one discriminator network; S02: Generate random noise z, pass the generated random noise z through the generator to generate a pseudo defect image G(z), and use the defect enhancement algorithm to enhance the pseudo defect image G(z) and the real defect image x to obtain image y f and y ′ f ; S03: Image y after defect enhancement f and y ′ f Train the discriminator network to distinguish between real and fake defect images; S04: Update the generator network so that it cannot distinguish the authenticity of defect images and obtain industrial defect samples; The discriminator network and the generator network are trained in an alternating training manner, and the alternating training method includes: S30: Fix the generator network parameters and perform discriminator optimization k times. The discriminator optimization includes: S31: From the prior distribution p (z) Randomly generate m random noise vectors z; S32: Distribution of p from dataset (x) Here, m real defect images x are randomly obtained; S33: Input the data-augmented real defect image into the discriminator network D. When calculating the loss function of the discriminator network, the label is set to true, and then the discriminator network is updated using the backpropagation algorithm. S34: Input the generated pseudo-defect image into the discriminator network D, set the label to false when calculating the loss function of the discriminator network, and then update the discriminator network using the backpropagation algorithm; S35: Use stochastic gradient ascent to optimize the discriminator cost function: Maximize the cost function; in, Represents the gradient of the corresponding discriminator parameters, i represents the i-th random noise vector; S40: After updating the discriminator network k times, update the generator once, including the following steps: S41: From the prior distribution p (z) Randomly generate m random noise vectors z; S42: Optimize the cost function of the generator using stochastic gradient descent: Minimize the cost function; in, represents the parameter gradient of the generator G.

2. The method for generating industrial defect samples based on a generative adversarial network according to claim 1, characterized in that: The defect enhancement algorithm in step S02 includes: The pseudo-defect image and the real defect image are converted from the spatial domain to the frequency domain through Fourier transform; Filter the image data through a bandpass filter to amplify the defect features; Use inverse Fourier transform to convert the image into spatial domain.

3. The method for generating industrial defect samples based on a generative adversarial network according to claim 1, characterized in that: The generator network includes one or more fully connected layers and one or more convolutional blocks; The fully connected layer maps the uniform probability distribution or Gaussian distribution into a specific distribution and generates an industrial defect image with a resolution that is relatively consistent with the first setting range; Each convolution block includes one or more convolution layers and an upsampling operation, which adds the input industrial defect image with a resolution that is relatively consistent with the first setting range and the noise to generate an industrial defect image with a resolution that is consistent with the second setting range and enriches the semantic content on it; The obtained uniform probability distribution or Gaussian distribution is mapped into high-definition images of industrial defects by the generator network.

4. The method for generating industrial defect samples based on a generative adversarial network according to claim 3, characterized in that: The discriminator network includes one or more convolution blocks, each of which includes one or more convolution layers, for distinguishing between real defect images and pseudo defect images generated by the generator network.

5. The method for generating industrial defect samples based on a generative adversarial network according to claim 1, characterized in that: The objective function of the alternating training of the discriminator network and the generator network is as follows: in, It means sampling the real data distribution and then finding the expectation of the function logD(x). represents sampling from Gaussian noise and finding the expectation of log(1-D(G(z)), represents the objective function to achieve generator optimization, It represents the optimization of the discriminator by maximizing the objective function.

6. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, the method for generating industrial defect samples based on a generative adversarial network according to any one of claims 1 to 5 is implemented.

7. An industrial defect sample generation system based on adversarial generative network, characterized in that: include: A generative adversarial network building module is used to build a generative adversarial network, wherein the generative adversarial network includes at least one generator network and at least one discriminator network; The defect enhancement module generates random noise z, and generates a pseudo defect image G(z) through the generator. The pseudo defect image G(z) and the real defect image x are enhanced by the defect enhancement algorithm to obtain the image y. f and y ′ f ; The discriminator network training module uses the defect-enhanced image y f and y ′ f Train the discriminator network to distinguish between real and fake defect images; The generator network update module updates the generator network so that it cannot distinguish the authenticity of defect images and obtains industrial defect samples; The discriminator network and the generator network are trained in an alternating training manner, and the alternating training method includes: S30: Fix the generator network parameters and perform discriminator optimization k times. The discriminator optimization includes: S31: From the prior distribution p (z) Randomly generate m random noise vectors z; S32: Distribution of p from dataset (x) Here, m real defect images x are randomly obtained; S33: Input the data-augmented real defect image into the discriminator network D. When calculating the loss function of the discriminator network, the label is set to true, and then the discriminator network is updated using the backpropagation algorithm. S34: Input the generated pseudo-defect image into the discriminator network D, set the label to false when calculating the loss function of the discriminator network, and then update the discriminator network using the backpropagation algorithm; S35: Use stochastic gradient ascent to optimize the discriminator cost function: Maximize the cost function; in, represents the gradient of the corresponding discriminator parameter, i represents the i-th random noise vector; S40: after updating the discriminator network k times, update the generator once, including the following steps: S41: From the prior distribution p (z) Randomly generate m random noise vectors z; S42: Optimize the cost function of the generator using stochastic gradient descent: Minimize the cost function; in, represents the parameter gradient of the generator G.

8. The industrial defect sample generation system based on adversarial generative network according to claim 7 is characterized in that: The defect enhancement algorithm includes: The pseudo-defect image and the real defect image are converted from the spatial domain to the frequency domain through Fourier transform; Filter the image data through a bandpass filter to amplify the defect features; Use inverse Fourier transform to convert the image into spatial domain.

9. The industrial defect sample generation system based on adversarial generative network according to claim 7, characterized in that: The objective function of the alternating training of the discriminator network and the generator network is as follows: in, It means sampling the real data distribution and then finding the expectation of the function logD(x). represents sampling from Gaussian noise and finding the expectation of log(1-D(G(z)), represents the objective function to achieve generator optimization, It represents the optimization of the discriminator by maximizing the objective function.

Citation Information

Patent Citations

  • Robot vision industrial product defect image data augmentation method

    CN111126446A

  • Method and system for generating industrial defect sample based on deep learning

    CN111127454A