GANs training method and device for relieving mode crash and storage medium

By cropping and feature extraction of images, combined with the optimization of patch samples and feature layer penalty terms, the mode collapse problem of GANs caused by insufficient image mode diversity is solved, and the diversity of generated images and global feature capture capabilities are improved, achieving Better GANs training effect.

CN118863007AActive Publication Date: 2024-10-29UNIV OF ELECTRONICS SCI & TECH OF CHINA +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410857817.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-10-29
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

GANs have a mode collapse problem caused by insufficient image mode diversity. The existing technology mainly starts from the optimization of generation methods and training strategies, and does not pay enough attention to the processing of the image data itself.

Method used

By cropping the images of the real data set, image patches of different sizes are generated, and the pre-trained feature extraction network is used to convert the patches into feature map patches, adding penalty terms for patch samples and feature layers, and optimizing the training of the generator and discriminator. Objective function to better learn the global features of the image.

Benefits of technology

It effectively alleviates the problem of mode collapse, improves the diversity of generated images and the ability to capture global features. The images generated by the generator are more diverse, reducing the impact of mode collapse and achieving better GANs training results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118863007A_ABST
    Figure CN118863007A_ABST
Patent Text Reader

Abstract

The invention discloses a GANs training method and device for relieving mode collapse and a storage medium, and relates to the technical field of generative adversarial network mode collapse. According to the invention, through the training method of cutting the original image and then carrying out distribution fitting, the problem caused by mode collapse is relieved; on the basis of a GAN image generation framework, in the stage of processing an original image, the original image is cut, original image patches with different sizes are generated, the global features of the image are better learned, and the diversity of the generated image is improved; in the picture generation process, constraint parameters of an image patch and a feature map patch are used in a potential space, and penalty terms are correspondingly increased; as image feature information contained in different convolutional layers is repeated, the weight of the specified convolutional layers is reduced so as to avoid repeated extraction of the feature information. According to the method, the generator can generate more diversified pictures including more global features of the images, the problem of mode collapse can be relieved, and a better GANs training result can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Generative Adversarial Networks (GANs) mode collapse technology, and in particular to a GANs training method, device and storage medium for alleviating mode collapse. Background Art

[0002] Image synthesis plays an increasingly important role in many multimedia applications. Therefore, research related to image synthesis such as GANs has gradually attracted more and more attention, and the mode collapse problem is one of the most important problems in the application of GANs. The GAN framework is to train two sub-networks at the same time: a generator for generating samples and a discriminator for distinguishing true and false samples. In the best case, the generator captures the real data distribution and generates similar new samples. However, the GAN framework mainly focuses on generating images with consistent visual fidelity, which will lead to insufficient diversity of generated data when there are many picture patterns. Some data patterns may be lost in the process of the generator learning the original data distribution, which is a common mode collapse problem.

[0003] In order to solve the mode collapse problem, researchers have proposed many different methods, including applying multiple generators, improving training strategies, adding penalty terms, using regularization, and adding distribution constraints. For the existing methods of adding distribution constraints, researchers focus on establishing a method to generate data rather than focusing on the image data itself. Therefore, it is necessary to propose a solution to mode collapse based on the image data itself. Summary of the invention

[0004] In order to address the deficiencies of the prior art, the present invention provides a GANs training method, device and storage medium for alleviating mode collapse, which utilizes pixel points of the image data itself as data points, and uses a cropping method to convert image samples into feature map patches through a pre-trained model, and uses different feature patches to achieve further distribution fitting, so as to better learn the distribution of the original image and obtain more global features of the original image, thereby alleviating the problems caused by mode collapse.

[0005] In one aspect, the present invention provides a GANs training method for alleviating mode collapse, comprising the following steps:

[0006] Step 1: Sample the data images of the real data set, and then use the generator of the Generative Adversarial Network (GANs) to randomly simulate and generate negative samples to generate original training positive and negative sample pairs;

[0007] Step 2, cropping the original training positive and negative sample pairs respectively to generate multiple groups of original image patches of positive and negative samples of different sizes;

[0008] Step 3, using a pre-trained feature extraction network to convert the original image patch into a feature map patch, that is, using the pre-trained feature extraction network to extract image features from the original image patch to obtain the corresponding feature map patch;

[0009] Step 4: Set the objective function of GANs during training to min G [max D V(D,G)+λ p L P (G)+λ f L f (G)], based on the objective function, the generator and discriminator of GANs are alternately trained and optimized, and the training stops when the preset convergence conditions are met, such as when the number of training times reaches the preset upper limit or the objective function value converges, to obtain a trained generator for the target image;

[0010] Among them, G represents the generator, D represents the discriminator, and λ p , f are the penalty terms L for patch samples respectively. P (G) and the penalty term L for the patch sample of the specified network layer f (G) Weight coefficient, V(D,G) is the basic objective function of the generative adversarial network, which is used to make the generator generate realistic image data as much as possible and to make the discriminator more accurately distinguish whether the input image is real or generated by the generator;

[0011] Penalty term for patch samples represents the penalty term of the kth convolutional layer of the generator;

[0012] Specify the penalty term for patch samples in the network layer Among them, m represents the layer number of the specified convolutional layer of the feature extraction network, Represents the penalty term of convolutional layer m in the specified convolutional layer set;

[0013] Among them, for any k-th convolutional layer, the corresponding penalty term The expression is:

[0014]

[0015] Among them, μ and σ represent the mean and standard deviation of the output feature map of the convolutional layer, respectively. The superscript i is the identifier of the image patch. The subscripts g and r are used to distinguish the generated image (output by the generator) from the real image, respectively. n represents the number of image patches.

[0016] Furthermore, when cropping the original training positive and negative sample pairs, they are sliced ​​into squares of multiple sizes.

[0017] Furthermore, the feature extraction network is a VGG series network, such as VGG-16, VGG-19, etc.

[0018] On the other hand, the present invention also provides a computer device, comprising a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement a GANs training method for alleviating mode collapse provided by the present invention.

[0019] On the other hand, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is loaded and executed by a processor to implement a GANs training method for alleviating mode collapse provided by the present invention.

[0020] The technical solution provided by the present invention brings at least the following beneficial effects:

[0021] The present invention alleviates the problem caused by mode collapse by using a training method of cropping the original image and then performing distribution fitting.

[0022] Based on the GAN image generation framework, when processing the original image, the original image is cropped to generate patches of the original image of different sizes to better learn the global features of the image and improve the diversity of the generated images;

[0023] In the process of generating images, the constraint parameters of image patches and feature map patches are used in the latent space, and the penalty terms are increased accordingly;

[0024] In view of the duplication of image feature information contained in different convolutional layers, the present invention reduces the weight of a specified convolutional layer to avoid repeated extraction of feature information.

[0025] The present invention allows the generator to generate more diverse images while incorporating more global features of the images, which helps alleviate the problem of mode collapse and thus achieve better GANs training results. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. 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.

[0027] Figure 1 A schematic diagram of a GANs training method process for alleviating mode collapse provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0028] To make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be described in detail and completely in conjunction with the drawings in the implementation of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings can be arranged and designed using different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the present application for protection, but merely represents selected embodiments of the present invention.

[0029] The embodiment of the present invention provides a GANs training method for alleviating mode collapse, which is a new method for fitting generated data and real data distribution for alleviating mode collapse.

[0030] The mode collapse problem is one of the most important problems in the current application of GANs. The GAN framework is to train two sub-networks at the same time: a generator for generating samples and a discriminator for distinguishing true and false samples. In the best case, the generator captures the real data distribution and generates similar new samples. However, the GAN framework mainly focuses on generating images with consistent visual fidelity, which will lead to insufficient diversity of generated data when there are many picture patterns. Some data patterns may be lost in the process of the generator learning the original data distribution, which is a common mode collapse problem.

[0031] In order to solve the problem of mode collapse, existing solutions are more about how to propose new generation methods and optimize training strategies. However, in the field of image processing, it is necessary to pay more attention to the image itself. Therefore, the embodiment of the present invention provides a GANs training method for alleviating mode collapse, see Figure 1 , which specifically includes the following steps:

[0032] Step 1: Sample the data images of the real data set, and use the generator to randomly simulate the generation of negative samples to generate the original training positive and negative sample pairs;

[0033] Step 2: Crop the original training positive and negative sample pairs to obtain multiple sets of original image patches of positive and negative sample pairs. Take an 8×8 image as an example, slice it into squares with side lengths of 1, 2, 3, and 4, and you can get a total of 64+16+4+4=88 original image patches;

[0034] Step 3: Use a pre-trained model (pre-trained feature extraction network) to convert the original image patch into a feature map patch, and perform multiple iterative training according to different feature maps of different convolutional layers. The present invention is not limited to a specific pre-trained model, because the best pre-trained model is different in different scenarios. In this embodiment, VGG-19 is used as an example to explain the specific implementation process of the embodiment of the present invention;

[0035] Step 4: Increase the penalty item corresponding to the patch sample Where μ and σ represent the mean and standard deviation respectively, the superscript i represents the i-th patch of the feature map, the subscripts g and r represent that the feature map is the generated image and the real image obtained by the pre-trained model, k represents that the feature map is the output model of the k-th convolutional layer, and n represents the total number of patches. Figure 1 It is generally regarded as a multi-channel image, so its mean and standard deviation are calculated by patches.

[0036] Step 5: Increase the penalty term for the patch samples of the corresponding N layers Here, this embodiment uses the 1st, 3rd, 5th, 9th, and 13th convolutional layers of VGG-19 to map the output feature constraints. Because at a deeper level, the features will contain more global feature information, but at the same time this information is also contained in more large pieces of shallow information. In order to avoid information duplication and balance between local and global features, the embodiment of the present invention assigns a smaller weight to deeper features. That is, the penalty term of the corresponding patch samples is added to several specified layers of the pre-trained model.

[0037] Step 6: Determine the training target min for GANs G [max D V(D,G)+λ p L P (G)+λ f L f (G)], and train. Alternately train and optimize the generator and discriminator. Where G represents the generator, D represents the discriminator, and λ p , f are the penalty terms L for patch samples respectively. P (G) and the penalty term L for the patch sample of the specified network layer f (G) weight coefficient, whose value is an empirical preset value, V(D, G) is the objective function of the generative adversarial network, that is, to make the generator generate realistic image data as much as possible, and to make the discriminator more accurately distinguish whether the input image is from the real one or generated by the generator. That is, the embodiment of the present invention adds two items on the basis of the objective function of the generative adversarial network: L P (G) and L f (G), where L P (G) is the penalty item The cumulative sum of

[0038] in,

[0039]

[0040] In the formula, E[·] represents the expectation, x represents the real data, that is, the real image, G(·) represents the output of the generator, D(·) represents the output of the discriminator, z represents the random noise of the input, and p z (z) represents the distribution of the random noise vector, and Pdata(x) represents the distribution of the real image x. This formula indicates that the discriminator tries to maximize the ability to accurately distinguish between real images and generated images, that is, maximize the above function, while the generator tries to minimize the above function.

[0041] The method of the embodiment of the present invention alleviates the problem caused by mode collapse by a training method of cropping the original image and then performing distribution fitting. For the image generation problem, when there are many data modes, the generator often cannot correctly learn the distribution of the data, resulting in some modes being ignored, which in turn causes the problem of mode collapse. Therefore, how to better learn the distribution of images and increase the diversity of generated images is the top priority for solving the problem of mode collapse. The method of the embodiment of the present invention is based on the framework of GAN image generation. In the stage of processing the original image, the original image is cropped to generate original image patches of different sizes. In this way, the global features of the image can be better learned, which has a great improvement effect on the diversity of generated images. In the process of generating pictures, the embodiment of the present invention proposes the constraint parameters of using image patches and feature map patches in the latent space, and increases the penalty items accordingly. In the processing of the pre-trained model, the original image patch is first converted into a feature map patch, and the penalty item of this behavior is increased. In addition, the embodiment of the present invention takes into account the repetition of image feature information contained in different convolutional layers, and reduces its weight for the specified convolutional layer to avoid repeated extraction of feature information. After processing multiple convolutional layers, a pre-set training target is obtained. This allows the generator to generate more diverse images while incorporating more global features of the image, which helps alleviate the problem of mode collapse and achieve better GANs training results.

[0042] In an exemplary embodiment, an embodiment of the present invention further provides a computer device, the computer device comprising a processor and a memory, the memory storing at least one computer program. The at least one computer program is loaded and executed by one or more processors to implement the GANs training method for mitigating mode collapse provided by an embodiment of the present invention. In an exemplary embodiment, an embodiment of the present invention further provides a computer-readable storage medium, the computer-readable storage medium storing at least one computer program, the at least one computer program is loaded and executed by the processor of the computer device to implement the GANs training method for mitigating mode collapse provided by an embodiment of the present invention.

[0043] In one possible implementation, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, an optical data storage device, or the like.

[0044] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

[0045] The above are only some embodiments of the present invention. For those skilled in the art, several modifications and improvements can be made without departing from the creative concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. A GANs training method for alleviating mode collapse, characterized in that: The following steps are involved: Step 1: Sample the data images of the real data set, and then use the generator of the Generative Adversarial Network (GANs) to randomly simulate and generate negative samples to generate original training positive and negative sample pairs; Step 2, cropping the original training positive and negative sample pairs respectively to generate multiple groups of original image patches of positive and negative samples of different sizes; Step 3: Use the pre-trained feature extraction network to extract image features from the original image patch to obtain the corresponding feature map patch, which is then input into the GANs generator. Step 4: Set the objective function of GANs during training to min G [max D V(D,G)+λ p L P (G)+λ f L f (G)], based on the objective function, the generator and discriminator of GANs are alternately trained and optimized, and the training is stopped when the preset training convergence condition is met, and a trained generator for the target image is obtained; Among them, G represents the generator, D represents the discriminator, and λ p , f are the penalty terms L for patch samples respectively. P (G) and the penalty term L for the patch sample of the specified network layer f (G) Weight coefficient, V(D,G) is the basic objective function of the generative adversarial network, which is used to make the generator generate realistic image data as much as possible and to make the discriminator more accurately distinguish whether the input image is real or generated by the generator; Penalty term for patch samples represents the penalty term of the kth convolutional layer of the generator; Specify the penalty term for patch samples in the network layer Among them, m represents the layer number of the specified convolutional layer of the feature extraction network, Represents the penalty term of convolutional layer m in the specified convolutional layer set; Among them, for any k-th convolutional layer, the corresponding penalty term The expression is: Among them, μ and σ represent the mean and standard deviation of the output feature map of the convolutional layer, respectively. The superscript i is the identifier of the image patch. The subscripts g and r are used to distinguish the generated image from the real image, respectively. n represents the number of image patches.

2. The method according to claim 1, characterized in that In step 2, when cropping the original training positive and negative sample pairs, they are sliced ​​into squares of multiple sizes.

3. The method according to claim 1, characterized in that The expression of the basic objective function V(D,G) is: Where E[·] represents the expectation, x represents the real image, G(·) represents the output of the generator, D(·) represents the output of the discriminator, z represents the random noise of the input, and p z (z) represents the distribution of the random noise vector, and Pdata(x) represents the distribution of the real image x.

4. The method according to claim 1, characterized in that The feature extraction network is the VGG series network.

5. A computer device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 4.

6. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Image generation model training method, image generation method and related device

    CN115019128A

  • Apparatus for denoising using hierarchical generative adversarial network and method thereof

    KR102466061B1