Defect image generation method and device based on generative adversarial network and related components
By generating simulated defect images using generative adversarial networks and performing wavelet fusion, the problem of small dataset sample size is solved, thus improving the detection performance of the defect detection model.
Patent Information
- Application Number
- CN202111647309.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2041-12-30
AI Technical Summary
Existing defect detection models suffer from small and unbalanced datasets, resulting in suboptimal detection performance, especially in complex industrial inspection environments.
Generative adversarial networks are used to generate imperfection-simulated images, and wavelet fusion processing is used to improve image quality, thereby increasing the quantity and quality of the dataset samples.
By generating simulated defect images using generative adversarial networks and performing wavelet fusion, the number and quality of dataset samples for the defect detection model were improved, thus enhancing the detection performance.
Smart Images

Figure CN114298954B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image generation technology, and in particular to a method, apparatus and related components for generating flawed images based on generative adversarial networks. Background Technology
[0002] Fabric defect detection is a crucial part of production and quality management in the textile industry. Manual inspection is susceptible to subjective factors and lacks consistency; furthermore, prolonged work under strong light severely impacts the eyesight of inspectors. Currently, machine vision-based surface defect detection equipment has widely replaced manual visual inspection in various industrial sectors. Existing deep learning-based defect detection methods can be broadly categorized into fully supervised learning models, unsupervised learning models, and other methods. Fully supervised learning models can be further divided into representation learning and metric learning. Representation learning essentially treats defect detection as a classification task, including three types of networks: a classification network, a detection network, and a segmentation network. There are three main methods for using classification networks to achieve this task: the first is to directly use the network for classification, but this requires the defect to have a significant proportion in the image, otherwise its features are easily pooled, and generally, only one type of defect is allowed in an image; the second is to use the network for defect localization, such as using a sliding window, but this is highly dependent on network performance and is relatively slow; the third is to use the network as a feature extractor, but this method relies on other classifiers to obtain the final classification result. Detection networks can be divided into two-stage and one-stage networks, primarily predicting the location and category of defects using features extracted from the network. Two-stage detection networks first acquire feature maps of the image, then calculate anchor box confidence, and finally classify the identified regions as defects. One-stage networks directly regress the location and category of anchor boxes at the output layer. Segmentation networks transform defect detection into a semantic segmentation or even instance segmentation problem between defects and normal regions, obtaining the location, category, and corresponding geometric attributes of defects. Metric learning uses deep learning to directly learn a similarity metric for the input image; it can also determine the location of defects by simultaneously using normal and defective samples as input.
[0003] The most common unsupervised learning methods are those based on normal samples in image space or feature space. These methods typically train on normal samples to develop strong capabilities for reconstructing and discriminating normal sample distributions. Image space-based methods reconstruct and complete samples through a network. When any sample image is input into the network, a reconstructed normal sample can be obtained. Subtracting the repaired image from the input image yields a residual, which is an indicator of whether the detected sample is abnormal. Feature space-based methods detect defects by analyzing the differences in feature distributions between normal and defective samples in feature space. Unsupervised learning methods are often used for simple, uniform texture surface defect detection, but their performance is less than ideal in complex industrial inspection environments. Other methods include weakly supervised and semi-supervised methods, which are less commonly used in defect detection. Weakly supervised methods typically use image-level category labeling (weak labels) to achieve segmentation / localization level detection results. Semi-supervised learning usually uses a large amount of unlabeled data and a small amount of labeled data to train the model, generally used for defect classification or recognition tasks. This method is not yet widely applicable to localization and segmentation tasks due to its relatively low accuracy.
[0004] In the defect detection process, cameras used in production capture images of fabric. A defect detection network model then detects the presence, type, and location of defects in the images. A good detection model requires fast detection speed and a good dataset. However, samples captured by industrial cameras often suffer from small sample sizes and imbalanced data types, failing to meet the requirements of a good dataset. Summary of the Invention
[0005] This invention provides a method, apparatus, and related components for generating defective images based on generative adversarial networks, aiming to solve the problem of small dataset sample size in existing detection models.
[0006] In a first aspect, embodiments of the present invention provide a method for generating flawed images based on generative adversarial networks, comprising:
[0007] Acquire images of the fabric and label the image category and defect location to obtain a true image of the defect;
[0008] The real image of the defect and the preset noise vector are input into the generator of the generative adversarial network to generate a simulated image of the defect;
[0009] Based on the real and simulated images of defects, the discriminator loss and generator loss of the generative adversarial network are calculated according to a preset loss function to obtain the discriminator loss and generator loss. The model parameters of the generative adversarial network are then iterated based on the discriminator loss and generator loss to obtain the defect image generation network.
[0010] The flawed image output by the flawed image generation network is combined with the corresponding real flawed image by wavelet fusion processing to obtain the ideal flawed image.
[0011] Secondly, embodiments of the present invention provide a defect image generation apparatus based on a generative adversarial network, comprising:
[0012] The acquisition module is used to acquire fabric images and label the image category and defect location of the fabric images to obtain real images of the defects;
[0013] The generation module is used to input the real image of the defect and the preset noise vector into the generator of the generative adversarial network to generate a simulated image of the defect;
[0014] An iterative module is used to calculate the discriminator loss and generator loss of the generative adversarial network based on the real flawed image and the simulated flawed image, respectively, according to a preset loss function, to obtain the discriminator loss and generator loss, and to iterate the model parameters of the generative adversarial network based on the discriminator loss and generator loss to obtain the flawed image generation network.
[0015] The fusion module is used to perform wavelet fusion processing on the flaw simulation image output by the flaw image generation network and the corresponding real flaw image to obtain an ideal flaw image.
[0016] Thirdly, embodiments of the present invention provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the defective image generation method based on generative adversarial networks as described in the first aspect.
[0017] Fourthly, embodiments of the present invention provide a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the defective image generation method based on generative adversarial networks as described in the first aspect.
[0018] This invention provides a method, apparatus, and related components for generating defective images based on generative adversarial networks (GANs). The method includes: acquiring a fabric image and labeling the image category and defect location to obtain a real defective image; inputting the real defective image and a preset noise vector into the generator of a GAN to generate a simulated defective image; calculating the discriminator loss and generator loss of the GAN based on the real defective image and the simulated defective image according to a preset loss function to obtain the discriminator loss and generator loss, and iterating the model parameters of the GAN based on the discriminator loss and generator loss to obtain a defective image generation network; and performing wavelet fusion processing on the simulated defective image output by the defective image generation network and the corresponding real defective image to obtain an ideal defective image. This invention generates simulated defective images using a trained GAN and uses wavelet fusion to fuse the simulated defective images with the corresponding real defective images, improving the quality of the simulated defective images while ensuring both the quantity and quality of the data samples. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart illustrating a defect image generation method based on generative adversarial networks provided in an embodiment of the present invention;
[0021] Figure 2 for Figure 1 A schematic diagram of the sub-process of step S103;
[0022] Figure 3 for Figure 1 A schematic diagram of the sub-process of step S104;
[0023] Figure 4 A schematic block diagram of a defect image generation device based on a generative adversarial network provided in an embodiment of the present invention;
[0024] Figure 5 This is a schematic block diagram of the network structure of a generative adversarial network (GAN) for a defect image generation method based on a generative adversarial network, provided in an embodiment of the present invention. Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0027] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0028] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0029] Please see below. Figure 1 , Figure 1 The flowchart of a defect image generation method based on generative adversarial networks provided in an embodiment of the present invention specifically includes steps S101 to S104.
[0030] Step S101: Obtain a fabric image and label the image category and defect location of the fabric image to obtain a true image of the defect;
[0031] In this embodiment, fabric images are acquired. These images are not required to contain flawless images, and the image categories can cover various defects as needed. Image categories and defect locations are labeled to obtain realistic images of the defects. It should be noted that the image categories can also include flawless realistic images. Fabric defects include stains, misaligned patterns, watermarks, fuzz, seam marks, seam tape, mothproofing, holes, creases, weave defects, missed prints, color differences, and weave folds, etc.
[0032] Step S102: Input the real image of the defect and the preset noise vector into the generator of the generative adversarial network to generate a simulated image of the defect;
[0033] In this embodiment, the parameters of the generator and discriminator in the generative adversarial network (GAN) are pre-initialized randomly. For the generator G in the GAN, a residual module is added to the network to adjust the number of channels in the output image. To increase the randomness of the generator's output image, a 100-dimensional noise vector uniformly distributed in (-1,1) is input to the generator G along with the real image of defects, and the generator outputs a simulated image of defects. The structure of the GAN is as follows: Figure 5 As shown.
[0034] Step S103: Based on the real image of the defect and the simulated image of the defect, calculate the discriminator loss and generator loss of the generative adversarial network according to the preset loss function to obtain the discriminator loss and generator loss, and iterate the model parameters of the generative adversarial network based on the discriminator loss and generator loss to obtain the defect image generation network.
[0035] In this embodiment, based on real images of defects and simulated images of defects, the discriminator loss and generator loss of the generative adversarial network are calculated according to the loss function; and the model parameters of the generative adversarial network are iterated based on the discriminator loss and generator loss to obtain the defect image generation network.
[0036] like Figure 2 As shown, in one embodiment, step S103 includes:
[0037] Step S201: Based on the defect location coordinates of the real defect image and the defect simulation image, calculate the pixel loss of the defect simulation image according to the preset pixel loss function to obtain the pixel loss;
[0038] Step S202: Input the real image of the defect and the simulated image of the defect into the discriminator of the generative adversarial network, calculate the loss of the discriminator according to the preset discriminator loss function, obtain the discriminator loss, and iterate the model parameters of the discriminator according to the discriminator loss to obtain the defect image discriminator.
[0039] Step S203: Input the flaw simulation image into the flaw image resolver, and calculate the adversarial loss of the generative adversarial network according to the preset adversarial loss function to obtain the adversarial loss;
[0040] Step S204: Based on the pixel loss and adversarial loss, calculate the generator loss according to the preset generator loss function to obtain the generator loss, and iterate the generator model parameters according to the generator loss to obtain the defective image generation network.
[0041] In this embodiment, based on the defect location coordinates of the real defect image and the defect simulation image, the pixel loss L of the defect simulation image is calculated according to the following pixel loss function. P :
[0042]
[0043] In the formula, L P α represents pixel loss; β represents weighting coefficients; S represents the simulated flawed image; R represents the real flawed image; (x,y) represents pixel coordinates; N represents the total number of pixels in the entire image; M represents the number of pixels in the flawed region; G represents the entire image region; L represents the flawed region.
[0044] Next, the real and simulated images of defects are input into the discriminator of the generative adversarial network. The discriminator's weight parameters are forward-propagated. To learn both defect region features and overall features simultaneously, the input real and simulated defect images are segmented into blocks along the anchor boxes, and all blocks are resized to 256*256. The number of blocks per image may vary, and the block size may also vary depending on the number of blocks. The discriminator loss L is calculated based on the discriminator loss function. D :
[0045]
[0046] Δ=ηL P ,
[0047] In the formula, L P Indicates pixel loss; L D N represents the resolution loss; B This indicates the number of blocks after the input image is divided into blocks along the anchor frame and all blocks are adjusted to 256*256. This represents the i-th block of the true image of the defect; Let represent the i-th block of the flawed simulated image; C is the ReLU function; θ represents the weight parameter; D represents the discriminator network; ▽ represents the gradient operator; γ represents the user-defined hyperparameter; η represents the hyperparameter used to limit the degree of control of the discriminator; the model parameters of the discriminator are iterated according to the discriminator loss to obtain the flawed image discriminator, which can be used to distinguish between real flawed images and flawed simulated images.
[0048] The flawed simulated image generated by the generator after one iteration is input into the flawed image resolver, and the adversarial loss L of the generative adversarial network is calculated according to the adversarial loss function. A Then, based on pixel loss L P and combat losses L A Calculate generator loss L S :
[0049]
[0050] L S =L P +γL A ,
[0051] In the formula, L S L represents the generator loss; A Indicates resistance to loss; N B This indicates the number of blocks after the input image is divided into blocks along the anchor frame and all blocks are adjusted to 256*256. denoted as the i-th block of the flawed simulated image output from the iterative generator; D represents the resolver network; γ represents a custom hyperparameter; I represents the flawed real image; z represents random noise;
[0052] The generator model parameters are iterated based on the generator loss to obtain the defective image generator; finally, based on the trained defective image generator and defective image discriminator, the trained defective image generation network is obtained.
[0053] Step S104: Perform wavelet fusion processing on the flaw simulation image output by the flaw image generation network and the corresponding real flaw image to obtain the ideal flaw image.
[0054] In this embodiment, a flaw simulation image is generated using a trained flaw image generation network. However, in order to improve the quality of the flaw simulation image, wavelet fusion processing is performed between the flaw simulation image and the corresponding real flaw image to obtain an ideal flaw image with higher image quality.
[0055] like Figure 3 As shown, in one embodiment, step S104 includes:
[0056] Step S301: Extract the high-frequency part of the flaw simulation image output by the flaw image generation network and the low-frequency part of the corresponding flaw real image;
[0057] Step S302: Fuse the high-frequency part and the low-frequency part to obtain the ideal defect image.
[0058] In this embodiment, the flawed image generated by the trained flawed image generation network is fused with the corresponding real flawed image using wavelet fusing. Specifically, this includes: performing wavelet decomposition on the flawed image and the real flawed image to obtain a series of sub-images with different frequency bands; then fusing the high-frequency part of the flawed image and the low-frequency part of the real flawed image to obtain the ideal flawed image. The ideal flawed image is then added to the flawed image database to obtain richer image data, thereby enhancing the original flawed image database.
[0059] This invention utilizes Generative Adversarial Networks (GLS-GAN) to generate simulated defect images, thereby enhancing fabric defect image data. An improved loss function is used, along with a pixel loss function, to focus the image learning on the local regions with defects, while preserving as much of the non-defective regions in the generated simulated defect images as possible. Finally, wavelet fusion is employed to fuse the simulated defect images with the corresponding real defect images, improving the quality of the simulated defect images. This approach ensures both the quantity and quality of the data samples used as the dataset.
[0060] This invention also provides an apparatus for generating defective images based on generative adversarial networks (GANs). This apparatus is used to execute any embodiment of the aforementioned method for generating defective images based on GANs. Specifically, please refer to... Figure 4 , Figure 4 This is a schematic block diagram of a defective image generation apparatus based on generative adversarial networks (GANs) provided in an embodiment of the present invention. This defective image generation apparatus 100 based on GANs can be configured in a server node.
[0061] like Figure 4 As shown, the defective image generation device 100 based on generative adversarial networks includes an acquisition module 110, a generation module 120, an iteration module 130, and a fusion module 140.
[0062] The acquisition module 110 is used to acquire fabric images and label the image category and defect location of the fabric images to obtain real images of defects;
[0063] The generation module 120 is used to input the real image of the defect and the preset noise vector into the generator of the generative adversarial network to generate a simulated image of the defect;
[0064] The iteration module 130 is used to calculate the discriminator loss and generator loss of the generative adversarial network based on the real flawed image and the simulated flawed image, respectively, according to a preset loss function, to obtain the discriminator loss and generator loss, and to iterate the model parameters of the generative adversarial network based on the discriminator loss and generator loss to obtain the flawed image generation network.
[0065] The fusion module 140 is used to perform wavelet fusion processing on the flaw simulation image output by the flaw image generation network and the corresponding flaw real image to obtain an ideal flaw image.
[0066] In one embodiment, the iteration module 130 includes:
[0067] The discriminator iteration unit is used to input the real image of the defect and the simulated image of the defect into the discriminator of the generative adversarial network, calculate the loss of the discriminator according to the preset discriminator loss function, obtain the discriminator loss, and iterate the model parameters of the discriminator according to the discriminator loss to obtain the defect image discriminator.
[0068] The pixel loss calculation unit is used to calculate the pixel loss of the flaw simulation image based on the flaw location coordinates in the real flaw image and the flaw simulation image, according to a preset pixel loss function, to obtain the pixel loss.
[0069] The adversarial loss calculation unit is used to input the flawed simulated image into the resolver, calculate the adversarial loss of the generative adversarial network according to the preset adversarial loss function, and obtain the adversarial loss.
[0070] The generator iteration unit is used to calculate the generator loss based on the pixel loss and adversarial loss according to a preset generator loss function, to obtain the generator loss, and to iterate the generator model parameters based on the generator loss to obtain the defective image generation network.
[0071] Those skilled in the art will readily understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention.
[0072] In the embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Units with the same function may be grouped into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, or it may be an electrical, mechanical, or other form of connection.
[0073] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention, depending on actual needs.
[0074] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0075] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server node, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks.
[0076] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for generating flawed images based on generative adversarial networks, characterized in that, include: Acquire images of the fabric and label the image category and defect location to obtain a true image of the defect; The real image of the defect and the preset noise vector are input into the generator of the generative adversarial network to generate a simulated image of the defect; Based on the real and simulated images of defects, the discriminator loss and generator loss of the generative adversarial network are calculated according to a preset loss function to obtain the discriminator loss and generator loss. The model parameters of the generative adversarial network are then iterated based on the discriminator loss and generator loss to obtain the defect image generation network. The flawed image output by the flawed image generation network is combined with the corresponding real flawed image by wavelet fusion processing to obtain the ideal flawed image. The process involves calculating the discriminator loss and generator loss of the generative adversarial network (GAN) based on the real and simulated defect images and a preset loss function, respectively, to obtain the discriminator loss and generator loss. The model parameters of the GAN are then iterated based on these discriminator and generator losses to obtain the defect image generation network. This includes: calculating the pixel loss of the simulated defect image based on the defect location coordinates of the real and simulated defect images and a preset pixel loss function; and inputting the real and simulated defect images into the discriminator of the GAN. In this process, the loss of the resolver is calculated according to a preset resolver loss function to obtain the resolver loss, and the model parameters of the resolver are iterated according to the resolver loss to obtain the defective image resolver; the defective simulated image is input into the defective image resolver, and the adversarial loss of the generative adversarial network is calculated according to a preset adversarial loss function to obtain the adversarial loss; based on the pixel loss and the adversarial loss, the loss of the generator is calculated according to a preset generator loss function to obtain the generator loss, and the model parameters of the generator are iterated according to the generator loss to obtain the defective image generation network; The step of performing wavelet fusion processing on the simulated defect image generated by the defect image generation network and the corresponding real defect image to obtain the ideal defect image includes: The simulated flaw image and the real flaw image are decomposed using wavelet decomposition to obtain a series of sub-images in different frequency bands. The high-frequency part of the simulated flaw image output by the flaw image generation network and the low-frequency part of the corresponding real flaw image are extracted. The high-frequency part and the low-frequency part are fused to obtain the ideal flaw image.
2. The defective image generation method based on generative adversarial networks according to claim 1, characterized in that, The pixel loss function is as follows: In the formula, L P α represents pixel loss; β represents weighting coefficients; S represents the simulated flawed image; R represents the real flawed image; (x,y) represents pixel coordinates; N represents the total number of pixels in the entire image; M represents the number of pixels in the flawed region; G represents the entire image region; L represents the flawed region.
3. The defect image generation method based on generative adversarial networks according to claim 1, characterized in that, The resolution loss function is as follows: Δ=ηL P , In the formula, L P Indicates pixel loss; L D N represents the resolution loss; B This indicates the number of blocks after the input image is divided into blocks along the anchor frame and all blocks are adjusted to 256*256. This represents the i-th block of the true image of the defect; Let represent the i-th block of the flawed simulated image; C is the ReLU function; θ represents the weight parameters; and D represents the resolution network. denoted by gradient operator; γ represents a user-defined hyperparameter; η represents a hyperparameter used to limit the degree of control over the resolver.
4. The defective image generation method based on generative adversarial networks according to claim 1, characterized in that, The generator loss function is as follows: THE S =L P +γL A , In the formula, L S L represents the generator loss; A Indicates resistance to loss; N B This indicates the number of blocks after the input image is divided into blocks along the anchor frame and all blocks are adjusted to 256*256. denoted as the i-th block of the flawed simulated image output from the iterative generator; D represents the resolver network; γ represents a custom hyperparameter; I represents the flawed real image; z represents random noise.
5. A defective image generation device based on generative adversarial networks, characterized in that, include: The acquisition module is used to acquire fabric images and label the image category and defect location of the fabric images to obtain real images of the defects; The generation module is used to input the real image of the defect and the preset noise vector into the generator of the generative adversarial network to generate a simulated image of the defect; An iterative module is used to calculate the discriminator loss and generator loss of the generative adversarial network based on the real flawed image and the simulated flawed image, respectively, according to a preset loss function, to obtain the discriminator loss and generator loss, and to iterate the model parameters of the generative adversarial network based on the discriminator loss and generator loss to obtain the flawed image generation network. The fusion module is used to perform wavelet fusion processing on the flaw simulation image output by the flaw image generation network and the corresponding real flaw image to obtain an ideal flaw image. The iteration module includes: The discriminator iteration unit is used to input the real image of the defect and the simulated image of the defect into the discriminator of the generative adversarial network, calculate the loss of the discriminator according to the preset discriminator loss function, obtain the discriminator loss, and iterate the model parameters of the discriminator according to the discriminator loss to obtain the defect image discriminator. The pixel loss calculation unit is used to calculate the pixel loss of the flaw simulation image based on the flaw location coordinates in the real flaw image and the flaw simulation image, according to a preset pixel loss function, to obtain the pixel loss. The adversarial loss calculation unit is used to input the flawed simulated image into the resolver, calculate the adversarial loss of the generative adversarial network according to the preset adversarial loss function, and obtain the adversarial loss. The generator iteration unit is used to calculate the generator loss based on the pixel loss and adversarial loss according to a preset generator loss function, to obtain the generator loss, and to iterate the generator model parameters based on the generator loss to obtain the defective image generation network. The step of performing wavelet fusion processing on the simulated defect image generated by the defect image generation network and the corresponding real defect image to obtain the ideal defect image includes: The simulated flaw image and the real flaw image are decomposed using wavelet decomposition to obtain a series of sub-images in different frequency bands. The high-frequency part of the simulated flaw image output by the flaw image generation network and the low-frequency part of the corresponding real flaw image are extracted. The high-frequency part and the low-frequency part are fused to obtain the ideal flaw image.
6. A computer device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the defective image generation method based on a generative adversarial network as described in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the defective image generation method based on generative adversarial networks as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Image defect sample augmentation method for power transmission and transformation equipment based on CycleGAN
CN112906769A
Image steganography method and system based on generative steganography confrontation
CN113538202A