Image generation and neural network training methods, apparatuses, devices, and media
By using generated images as input to the generator to train the generative adversarial network, the discriminator overfitting problem is solved, the quality of generated images is improved, and the computational cost is reduced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SENSETIME INT PTE LTD
- Filing Date
- 2022-02-25
- Publication Date
- 2026-05-01
AI Technical Summary
Generative adversarial networks are prone to discriminator overfitting when training data is limited, resulting in unstable quality of generated images.
By using generated images as input to the generator as real images and training it with a generative adversarial network, the accuracy of the discriminator in distinguishing between real and fake images is reduced, thereby alleviating the overfitting problem.
This improves the image generation performance of generative adversarial networks with limited training data, reduces computational costs, and improves the quality of generated images.
Smart Images

Figure CN114565693B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to computer vision processing technology, and more particularly to an image generation and neural network training method, apparatus, electronic device, computer storage medium, and computer program. Background Technology
[0002] Among related technologies, Generative Adversarial Networks (GANs) have achieved outstanding performance in capturing high-dimensional representations of visual data and creating realistic images. However, GANs typically require a large amount of training data to achieve good performance. Therefore, improving the image generation quality of GANs when training data is limited is an urgent technical problem to be solved. Summary of the Invention
[0003] This disclosure provides a technical solution for image generation and neural network training.
[0004] This disclosure provides an image generation method, the method comprising:
[0005] Obtain the original image;
[0006] The original image is input into a trained generative adversarial network (GAN), and the trained GAN processes the original image to obtain a first generated image. The training data of the GAN includes a set of sample images and a second generated image. The second generated image includes at least a portion of the generated image set. The generated image set represents the generated image obtained by processing the sample image set using the GAN.
[0007] In some embodiments, the method further includes:
[0008] Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network;
[0009] In the generated image set, obtain the number of second generated images that match the overfitting parameters.
[0010] In some embodiments, obtaining the overfitting parameters includes:
[0011] Obtain at least one of a first discrimination result and a second discrimination result; the first discrimination result represents the discrimination result corresponding to the sample image set, and the second discrimination result represents the discrimination result corresponding to the generated image set;
[0012] The overfitting parameters are obtained based on at least one of the first and second discrimination results.
[0013] In some embodiments, obtaining the overfitting parameters based on at least one of the obtained first discrimination result and second discrimination result includes one of the following:
[0014] The first average value is used as the overfitting parameter, where the first average value represents the average value of the sign function of the logarithmic output of the first discrimination result;
[0015] The negative of the second average value is used as the overfitting parameter, where the second average value represents the average of the sign function of the logarithmic output of the second discrimination result;
[0016] Half of the difference between the first average and the second average is used as the overfitting parameter.
[0017] In some embodiments, obtaining the number of second generated images matching the overfitting parameters in the generated image set includes:
[0018] Determine the selection probability, which represents the probability of selecting an image from the generated image set;
[0019] The selection probability is updated based on the value of the overfitting parameter to obtain the updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability.
[0020] Based on the updated selection probability, the second generated image, which matches the number of overfitting parameters, is selected from the generated image set.
[0021] In some embodiments, updating the selection probability based on the value of the overfitting parameter to obtain the updated selection probability includes the following:
[0022] If the value of the overfitting parameter is greater than a set threshold, the value of the selection probability is increased to obtain the updated selection probability; if the value of the overfitting parameter is less than or equal to the set threshold, the value of the selection probability is decreased to obtain the updated selection probability.
[0023] In some embodiments, the method further includes:
[0024] Obtain a preset selection probability; select the second generated image from the generated image set according to the preset selection probability.
[0025] This disclosure provides a neural network training method, the method comprising:
[0026] The sample image set is input into the generative adversarial network, and the generative adversarial network is used to process the sample image set to obtain the generated image set;
[0027] Obtain a second generated image, the second generated image comprising at least a portion of the images in the generated image set;
[0028] The sample image set and the second generated image are used as training data for the generative adversarial network, and the generative adversarial network is trained based on the training data.
[0029] In some embodiments, obtaining the second generated image includes:
[0030] Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network;
[0031] In the generated image set, obtain the number of second generated images that match the overfitting parameters.
[0032] In some embodiments, obtaining the overfitting parameters includes:
[0033] Obtain at least one of a first discrimination result and a second discrimination result; the first discrimination result represents the discrimination result corresponding to the sample image set, and the second discrimination result represents the discrimination result corresponding to the generated image set;
[0034] The overfitting parameters are obtained based on at least one of the first and second discrimination results.
[0035] In some embodiments, obtaining the overfitting parameters based on at least one of the obtained first discrimination result and second discrimination result includes one of the following:
[0036] The first average value is used as the overfitting parameter, where the first average value represents the average value of the sign function of the logarithmic output of the first discrimination result;
[0037] The negative of the second average value is used as the overfitting parameter, where the second average value represents the average of the sign function of the logarithmic output of the second discrimination result;
[0038] Half of the difference between the first average and the second average is used as the overfitting parameter.
[0039] In some embodiments, obtaining the number of second generated images matching the overfitting parameters in the generated image set includes:
[0040] Determine the selection probability, which represents the probability of selecting an image from the generated image set;
[0041] The selection probability is updated based on the value of the overfitting parameter to obtain the updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability.
[0042] Based on the updated selection probability, the second generated image, which matches the number of overfitting parameters, is selected from the generated image set.
[0043] In some embodiments, updating the selection probability based on the value of the overfitting parameter to obtain the updated selection probability includes the following:
[0044] If the value of the overfitting parameter is greater than a set threshold, the value of the selection probability is increased to obtain the updated selection probability; if the value of the overfitting parameter is less than or equal to the set threshold, the value of the selection probability is decreased to obtain the updated selection probability.
[0045] In some embodiments, the method further includes:
[0046] Obtain a preset selection probability; select the second generated image from the generated image set according to the preset selection probability.
[0047] This disclosure provides an image generation apparatus, the apparatus comprising:
[0048] The first acquisition module is used to acquire the original image;
[0049] The first processing module is used to input the original image into a trained generative adversarial network (GAN), and use the trained GAN to process the original image to obtain a first generated image. The training data of the GAN includes a set of sample images and a second generated image. The second generated image includes at least a portion of the generated image set. The generated image set represents the generated image obtained by processing the sample image set using the GAN.
[0050] In some embodiments, the first acquisition module is further configured to:
[0051] Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network;
[0052] In the generated image set, obtain the number of second generated images that match the overfitting parameters.
[0053] This disclosure provides a neural network training apparatus, the apparatus comprising:
[0054] The second processing module is used to input the sample image set into the generative adversarial network, and use the generative adversarial network to process the sample image set to obtain the generated image set.
[0055] The second acquisition module is used to acquire a second generated image, the second generated image including at least a portion of the images in the generated image set;
[0056] The training module is used to use the sample image set and the second generated image as training data for the generative adversarial network, and to train the generative adversarial network based on the training data.
[0057] This disclosure also provides an electronic device, including a processor and a memory for storing a computer program capable of running on the processor; wherein,
[0058] The processor is used to run the computer program to execute any of the above-described image generation methods or any of the above-described neural network training methods.
[0059] This disclosure also provides a computer storage medium storing a computer program that, when executed by a processor, implements any of the above-described image generation methods or any of the above-described neural network training methods.
[0060] This disclosure also provides a computer program including computer-readable code. When the computer-readable code is run in an electronic device, the processor in the electronic device executes an execution method for implementing any of the above-described image generation methods or any of the above-described neural network training methods.
[0061] In this embodiment of the disclosure, at least a portion of the generated images can be input into the generator as real images to train the generative adversarial network. The training process of the generative adversarial network is based on the discriminator's discrimination results on the images input to the generator and the generated images output by the generator. Since the generated images are fake images, and the generator's goal during the training process of the generative adversarial network is to generate fake images that are as close as possible to real images to deceive the discriminator, the accuracy of the discriminator in distinguishing between real and fake images can be reduced to a certain extent, thereby helping to alleviate the overfitting problem of the discriminator and enabling the trained generative adversarial network to have better image generation performance.
[0062] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0063] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the specification, serve to illustrate the technical solutions of this disclosure.
[0064] Figure 1A This diagram illustrates the logarithmic output of the discriminator in the context of training a generative adversarial network using both the complete dataset and a portion of the complete dataset.
[0065] Figure 1B This is a schematic diagram of the sign function average of the logarithmic output of the discriminator in the case of training a generative adversarial network using the complete dataset and partial data of the complete dataset in related technologies;
[0066] Figure 1C This diagram illustrates the variation curves of FID (Fréchet Inception Distance) when a generative adversarial network is trained using the complete dataset and a portion of the complete dataset in related technologies.
[0067] Figure 2 This is a flowchart of an image generation method according to an embodiment of the present disclosure;
[0068] Figure 3 This is a flowchart of a neural network training method according to an embodiment of the present disclosure;
[0069] Figure 4 This is a flowchart illustrating the training process of a generative adversarial network according to an embodiment of this disclosure.
[0070] Figure 5 This is a schematic diagram of the structure of the image generation apparatus according to an embodiment of the present disclosure;
[0071] Figure 6 This is a schematic diagram of the structure of a neural network training device according to an embodiment of the present disclosure;
[0072] Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. Detailed Implementation
[0073] The present disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the embodiments provided herein are merely illustrative of the present disclosure and are not intended to limit the present disclosure. Furthermore, the embodiments provided below are some embodiments for implementing the present disclosure, and not all embodiments for implementing the present disclosure. Unless otherwise specified, the technical solutions described in the embodiments of the present disclosure can be implemented in any combination.
[0074] It should be noted that, in the embodiments of this disclosure, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a method or apparatus that includes a list of elements includes not only the elements expressly described, but also other elements not expressly listed, or elements inherent to implementing the method or apparatus. Without further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other related elements (e.g., steps in the method or units in the apparatus; for example, a unit may be a portion of circuitry, a portion of a processor, a portion of a program or software, etc.) in the method or apparatus that includes that element.
[0075] For example, the image generation method and neural network training method provided in this disclosure include a series of steps, but the image generation method and neural network training method provided in this disclosure are not limited to the steps described. Similarly, the image generation apparatus and neural network training apparatus provided in this disclosure include a series of modules, but the apparatus provided in this disclosure is not limited to the modules explicitly described, but may also include modules that need to be set up for obtaining relevant information or processing based on information.
[0076] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.
[0077] The embodiments disclosed herein can be applied to computer systems consisting of terminals and / or servers, and can operate in conjunction with a wide range of other general-purpose or special-purpose computing system environments or configurations. Here, the terminal can be a thin client, a thick client, a handheld or laptop device, a microprocessor-based system, a set-top box, a programmable consumer electronics product, a network PC, a minicomputer system, etc., and the server can be a minicomputer system, a mainframe computer system, and a distributed cloud computing environment that includes any of the above systems, etc.
[0078] Electronic devices such as terminals and servers can perform corresponding functions through the execution of program modules. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc. Computer systems / servers can be implemented in a distributed cloud computing environment, where tasks are executed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can reside on local or remote computing system storage media, including storage devices.
[0079] In related technologies, after training a generative adversarial network using a large amount of training data, the trained generative adversarial network has high image generation quality; however, in some practical scenarios, it is not feasible to collect enough training data, especially in some data-sparse and privacy-sensitive application scenarios.
[0080] Generally, a Generative Adversarial Network (GAN) consists of a generator and a discriminator. Training a GAN involves training both the generator and the discriminator simultaneously. When training data is limited, overfitting of the discriminator can occur during training. Discriminator overfitting means that the discriminator judges the realism of generated images too accurately. However, a GAN requires the discriminator to judge the realism of generated images with a probability of around 0.5. Therefore, discriminator overfitting can prevent the trained GAN from consistently producing high-quality generated images.
[0081] The overfitting problem of the discriminator is illustrated below with reference to the accompanying drawings.
[0082] Figure 1A This diagram illustrates the logarithmic output of a discriminator in related technologies when training a generative adversarial network using both the complete dataset and a portion of the complete dataset. Figure 1B This is a schematic diagram of the sign function average of the logarithmic output of the discriminator in the case of training a generative adversarial network using the complete dataset and partial data of the complete dataset in related technologies. Figure 1A and Figure 1B In this dataset, the total data size is 70K, and the partial data comprises 10% of the total dataset, which is 7K. It's important to note that the total data size of the complete dataset refers to the total number of images it contains. For example, a total data size of 70K means the complete dataset contains 70,000 images. Similarly, the total data size of a partial dataset refers to the number of images contained within that partial dataset. For example, a total data size of 7K means the partial dataset contains 7,000 images.
[0083] Figure 1A In the diagram, the horizontal axis represents the training progress, and the vertical axis represents the logarithmic output of the discriminator; D real .70K represents the logarithmic output of the discriminator's judgment result on a real image when the generative adversarial network is trained on the complete dataset, D fake .70K represents the logarithmic output of the discriminator's judgment of generated images when the generative adversarial network is trained on the complete dataset, and D real.7K represents the logarithmic output of the discriminator's judgment of real images when the generative adversarial network is trained using a portion of the complete dataset; D fake .7K represents the logarithmic output of the discriminator's judgment of the generated image when the generative adversarial network is trained using a portion of the complete dataset.
[0084] from Figure 1A It can be seen that in the initial stage of training, the logarithmic outputs of the discriminator's discrimination results for real and generated images are relatively close; however, as training progresses, compared with the scheme of training the generative adversarial network using the complete dataset, the logarithmic outputs of the discriminator's discrimination results for real and generated images in the generative adversarial network using only limited training data (i.e., a portion of the complete dataset) diverge more quickly.
[0085] Figure 1B In the diagram, the horizontal axis represents the training progress, and the vertical axis represents the average sign function of the discriminator's logarithmic output; sign(D real ).70K represents the average sign function of the discriminator's logarithmic output of the discrimination results on real images when the generative adversarial network is trained on the complete dataset, sign(D fake ).70K represents the average sign function of the discriminator's logarithmic output of the discrimination results for generated images when the generative adversarial network is trained on the complete dataset, sign(D real ).7K represents the logarithmic mean of the sign function of the discriminator's judgment results on real images when the generative adversarial network is trained using partial data from the complete dataset, sign(D fake ).7K represents the sign function average of the logarithmic output of the discriminator's discrimination results for generated images when the generative adversarial network is trained using partial data from the complete dataset.
[0086] from Figure 1B It can be seen that, compared with the scheme of training the generative adversarial network using the complete dataset, the average sign function of the logarithmic output of the discriminator's discrimination results for real and generated images is more divergent in the generative adversarial network using only limited training data (i.e., a portion of the complete dataset).
[0087] Overfitting of the discriminator can also cause generative adversarial networks to have difficulty converging. In practical applications, FID (Fréchet Inception Distance) can be used to represent the convergence trend of generative adversarial networks. FID represents the distance between the real image and the generated image in the feature layer. The smaller the FID value, the easier it is for the generative adversarial network to converge.
[0088] Figure 1CThis is a schematic diagram illustrating the change in FID (Firmware ID) when using the complete dataset and partial data from the complete dataset to train a generative adversarial network in related technologies. Figure 1C In the diagram, the horizontal axis represents training progress, and the vertical axis represents FID. FID.70K represents the FID change curve when training the generative adversarial network using the complete dataset, and FID.7K represents the FID change curve when training the generative adversarial network using a portion of the complete dataset. Figure 1C It can be seen that, as training progresses, the FID value of the generative adversarial network using only limited training data (i.e., a portion of the complete dataset) is larger than that of the scheme that trains the generative adversarial network using the complete dataset. In other words, the generative adversarial network is more difficult to converge.
[0089] In related technologies, the following two solutions can be adopted to address the overfitting problem of the discriminator: Solution 1) During the training of the generative adversarial network, the real images input to the generator and the generated images generated by the generator are augmented using standard data to increase the diversity of training data and reduce the overfitting of the discriminator; Solution 2) An additional model regularization term is used to process the generative adversarial network. For example, noise can be introduced or gradient penalty can be used to appropriately weaken the discriminator, thereby improving the stability of the training process.
[0090] However, using standard data for augmentation in Scheme 1) introduces a significant additional computational cost; Scheme 2) does not significantly improve the performance of generative adversarial networks, is sensitive to the setting of weight parameters, and requires fine manual adjustment. Different model regularization terms need to be set for different image generation scenarios and different training states (convergence or divergence states of the discriminator output). That is, a model regularization term can only be applied to one image generation scenario or one training state, so Scheme 2) has low applicability.
[0091] In view of the above-mentioned technical problems existing in related technologies, this disclosure provides an image generation method. The image generation method of this disclosure can be applied to scenarios such as image generation, image editing, image processing, image-to-image conversion, video generation, video editing, short video applications, and film processing.
[0092] Figure 2 This is a flowchart of an image generation method according to an embodiment of the present disclosure, such as... Figure 2 As shown, the process may include:
[0093] Step 201: Obtain the original image.
[0094] In the embodiments of this disclosure, the original image can be acquired in a variety of ways. For example, the original image can be received by an image acquisition device, or the original image can be received by a communication device from other devices. Alternatively, the original image can be saved locally in advance and read from the local device when the original image is needed.
[0095] The original image may be in the format of Joint Photographic Experts Group (JPEG), Bitmap (BMP), Portable Network Graphics (PNG), or other formats. It should be noted that this is merely an example of the format and source of the original image, and the embodiments disclosed herein do not limit the format and source of the original image.
[0096] Step 202: Input the original image into the trained generative adversarial network, and use the trained generative adversarial network to process the original image to obtain the first generated image; the training data of the generative adversarial network includes a sample image set and a second generated image, the second generated image includes at least a portion of the generated image set, and the generated image set represents the generated image obtained by processing the sample image set using the generative adversarial network.
[0097] Here, the sample image set refers to the set of images used to train the generative adversarial network. In practical applications, the sample image set can be obtained from a public dataset or from local storage. For example, public datasets can be the FFHQ dataset, AFHQ dataset, Anime dataset, CUB dataset, CUFED5 dataset, SUN dataset, Manga109 dataset, etc. In this embodiment, after the sample image set is input into the generator of the generative adversarial network, at least a portion of the generated images output by the generator of the generative adversarial network can be added to the sample image set to update the sample image set.
[0098] In the process of training a generative adversarial network, a sample image set can be obtained first. After obtaining the sample image set, it can be input into the generator of the generative adversarial network. The generator processes the sample image set to obtain a generated image set. Then, at least a portion of the generated image set can be selected as the second generated image set. The second generated image set is input into the generator and processed by the generator.
[0099] During the training of a generative adversarial network, the discriminator of the generative adversarial network is used to judge the authenticity of the image input to the generator and the generated image, and obtain the corresponding judgment result; the judgment result represents the probability that the corresponding image belongs to the real image.
[0100] In this embodiment of the disclosure, the network parameter values of the generative adversarial network can be continuously adjusted according to the discrimination results obtained by the discriminator. If the generative adversarial network after the network parameter values are adjusted does not meet the training termination condition, at least a portion of the generated images from the generator can be re-input into the generator to obtain new generated images, and the discriminator can be used again to judge the authenticity of the images input to the generator and the generated images output by the generator. If the generative adversarial network after the network parameter values are adjusted meets the training termination condition, the generative adversarial network after the network parameter values are adjusted can be regarded as the trained generative adversarial network.
[0101] Here, the training termination condition can be that the number of iterations in the training process of the generative adversarial network reaches a set number, or that the generative adversarial network with adjusted network parameter values meets the set accuracy requirements for image processing; here, the set number of iterations can be an empirically set value; the set accuracy requirements are related to the loss of the generative adversarial network, for example, the set accuracy requirements can be that the loss of the generative adversarial network is less than a set loss, and the set loss can be an empirically set loss value.
[0102] In related technologies, during the training of generative adversarial networks (GANs), the discriminator typically distinguishes between two types of images: the image input to the generator and the generated image obtained by the generator. The image input to the generator is usually considered a real image; that is, the discriminator can obtain the discrimination results for both real and generated images. However, in this embodiment, after obtaining a set of generated images using the generator, a second generated image can be selected from the set and input into the generator as a real image. In other words, compared to the training schemes of GANs in related technologies, there is no need to add additional real images as standard data; instead, the generated image can be input into the generator as a real image to continue training the GAN.
[0103] After obtaining the trained generative adversarial network, the generator in the trained generative adversarial network can be used to process the original image to obtain the first generated image.
[0104] In practical applications, steps 201 to 202 can be implemented using a processor in an electronic device. The processor can be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field-Programmable Gate Array (FPGA), Central Processing Unit (CPU), controller, microcontroller, and microprocessor.
[0105] Understandably, in related technologies, when training data is limited, the discriminator may overfit during the training of a generative adversarial network (GAN). Overfitting means the discriminator excessively and accurately judges the realism of generated images. Since the GAN requires the discriminator to have a probability of judging the realism of generated images around 0.5, overfitting prevents the trained GAN from consistently producing high-quality generated images. However, in this embodiment, at least some generated images can be input as real images into the generator for GAN training. The training process is based on the discriminator's judgment of the input images and the generated images output. Because the generated images are fake, and the generator's goal during training is to generate images that closely approximate real images to deceive the discriminator, the discriminator's accuracy in distinguishing real and fake images can be reduced to some extent. This helps alleviate the discriminator's overfitting problem, resulting in a trained GAN with better image generation performance.
[0106] Furthermore, this embodiment does not require additional standard data to increase the diversity of training data. Instead, at least some of the generated images can be regarded as real images and added to the training data of the generative adversarial network. Although the training process of the generative adversarial network in this embodiment requires the introduction of certain computational costs, the computational costs introduced are lower than those of the above scheme 1) and can be ignored.
[0107] In conjunction with the foregoing description, this disclosure also proposes a neural network training method; Figure 3This is a flowchart of a neural network training method according to an embodiment of the present disclosure, such as... Figure 3 As shown, the process may include:
[0108] Step 301: Input the sample image set into the generative adversarial network, and use the generative adversarial network to process the sample image set to obtain the generated image set.
[0109] Step 302: Obtain a second generated image, which includes at least a portion of the generated image set.
[0110] Step 303: Use the sample image set and the second generated image as training data for the generative adversarial network, and train the generative adversarial network based on the training data.
[0111] The implementation methods of steps 301 to 303 have been described in the foregoing embodiments and will not be repeated here.
[0112] In this embodiment of the disclosure, the training process of the generative adversarial network can also be achieved through... Figure 4 Please provide an explanation, such as Figure 4 As shown, G represents the generator, D represents the discriminator, and p z (z) represents the set of input noise variables. The generator G can output the generated image G(z) based on the input real image x and the noise variables z, where x is the image in the training data. The discriminator D can discriminate the input real image x and obtain the discrimination result D(x) of the real image x. The discriminator D can also discriminate the generated image G(z) and obtain the discrimination result D(G(z)) of the generated image G(z).
[0113] In this embodiment of the disclosure, after obtaining the generated image G(z), the generated image G(z) can be added to the training data with a certain probability, so as to continue the training of the generative adversarial network.
[0114] The following two examples illustrate how to obtain the second generated image.
[0115] In the first example, a preset selection probability can be obtained; based on the preset selection probability, a second generated image is selected from the generated image set.
[0116] Here, the preset selection probability represents the probability of selecting any image from the generated image set; the preset selection probability is a fixed selection probability. During the training of the adversarial generative network, after each generation of the generator's generated image set, the second generated image can be selected from the generated image set obtained each time according to the fixed selection probability.
[0117] In practical applications, the preset selection probability can be an empirically set value, such as 0.4, 0.5, or 0.6. Alternatively, the preset selection probability can be determined by trial and error. That is, the selection probability can be set to multiple values, and an adversarial generative network can be trained for each value. Then, the image generation quality of the trained adversarial generative network can be tested to obtain test results. Finally, the preset selection probability value is determined based on the test results corresponding to each selection probability value.
[0118] Understandably, the second generated image is selected by a preset selection probability. Since the preset selection probability is fixed, the second generated image can be selected from the generated image set according to the fixed selection probability each time the generator's generated image set is obtained. That is, there is no need to select the second generated image according to different selection probabilities in each generated image set obtained according to dynamically changing selection probabilities. It has the characteristics of being simple and easy to implement.
[0119] In the second example, the probability of selecting the second generated image from the generated image set changes dynamically as the training progress of the generative adversarial network, as illustrated below.
[0120] First, overfitting parameters are obtained, which characterize the degree of overfitting of the discriminator in the generative adversarial network. Then, in the generated image set, a second generated image with a number matching the overfitting parameters is obtained.
[0121] Here, the larger the overfitting parameter, the higher the degree of overfitting of the discriminator of the generative adversarial network. For example, the value of the overfitting parameter ranges from 0 to 1. When the overfitting parameter is 0, it means that the discriminator of the generative adversarial network does not have an overfitting problem. When the overfitting parameter is 1, it means that the discriminator of the generative adversarial network is in a state of complete overfitting.
[0122] As can be seen, in this embodiment of the present disclosure, the generated images are not blindly used as training data. Instead, the probability of selecting any image from the generated image set can be adaptively adjusted according to the current overfit of the discriminator of the generative adversarial network. Thus, the second generated image can be adaptively selected according to the corresponding image selection probability based on the current overfit of the discriminator of the generative adversarial network.
[0123] To accurately derive the overfitting parameters, at least one of the first discrimination result and the second discrimination result can be obtained first; the first discrimination result represents the discrimination result corresponding to the sample image set, and the second discrimination result represents the discrimination result corresponding to the generated image set; then, the overfitting parameters are obtained based on at least one of the first discrimination result and the second discrimination result.
[0124] Reference Figure 4 The first discrimination result includes the discrimination result D(x) of the real image x, and the second discrimination result includes the discrimination result D(G(z)) of the generated image G(z).
[0125] Understandably, since the discrimination results corresponding to the sample image set and the discrimination results corresponding to the generated image set are both obtained using the same discriminator, at least one of the discrimination results corresponding to the sample image set and the discrimination results corresponding to the generated image set can reflect the degree of overfitting of the discriminator. Therefore, the embodiments of this disclosure can accurately derive the overfitting parameters based on the discrimination results corresponding to the sample image set and the discrimination results corresponding to the generated image set.
[0126] The following examples illustrate several ways to obtain overfitting parameters based on at least one of the obtained first and second discrimination results.
[0127] In the first implementation, the first average value is used as the overfitting parameter. The first average value represents the average value of the sign function of the logarithmic output of the first discrimination result.
[0128] In the first implementation, the overfitting parameter λ can be obtained from formulas (1) and (2):
[0129] λ=E(sign(D real )) (1)
[0130] D real =logit(D(x)) (2)
[0131] Where logit(·) represents logarithmic output, sign(·) represents the sign function value, and E(·) represents taking the average value.
[0132] In the second implementation, the negative of the second average value is used as the overfitting parameter, where the second average value represents the average of the sign function of the logarithmic output of the second discrimination result.
[0133] In the second implementation, the overfitting parameter λ can be obtained from formulas (3) and (4):
[0134] λ=-E(sign(D fake (3)
[0135] D fake =logit(D(G(z))) (4)
[0136] In the third implementation, half of the difference between the first average and the second average is used as the overfitting parameter.
[0137] In the third implementation, the overfitting parameter λ can be obtained from formula (5):
[0138]
[0139] As can be seen, the embodiments of this disclosure can accurately derive overfitting parameters based on the discrimination results corresponding to the sample image set and the discrimination results corresponding to the generated image set.
[0140] For the generated image set, the implementation of obtaining the number of second generated images that match the overfitting parameters can be exemplarily as follows: First, the selection probability can be determined, which represents the probability of selecting any image in the generated image set; then, the value of the selection probability is updated according to the value of the overfitting parameters to obtain the updated selection probability; the value of the overfitting parameters is positively correlated with the updated selection probability; finally, according to the updated selection probability, the number of second generated images that match the overfitting parameters is selected from the generated image set.
[0141] In this embodiment of the disclosure, the initial value of the selection probability can be set to 0; after each overfitting parameter is obtained, the current selection probability can be updated according to the magnitude of the overfitting parameter; if the value of the overfitting parameter is large, the updated selection probability is large, and more images can be selected from the generated image set as the second generated image; if the value of the overfitting parameter is small, the updated selection probability is small, and fewer images can be selected from the generated image set as the second generated image.
[0142] As can be seen, in this embodiment of the present disclosure, the second generated image can be accurately and reasonably selected according to the value of the overfitting parameter. That is, the training data can be adaptively adjusted according to the current overfitting degree of the discriminator of the generative adversarial network.
[0143] For example, when updating the selection probability based on the value of the overfitting parameter, the selection probability can be increased to obtain the updated selection probability if the value of the overfitting parameter is greater than a set threshold; and the selection probability can be decreased to obtain the updated selection probability if the value of the overfitting parameter is less than or equal to the set threshold.
[0144] In this embodiment of the disclosure, the threshold can be set empirically, for example, the threshold can be set to 0.5, 0.6 or 0.7; the threshold can also be determined according to the number of images in the sample image set, and the threshold is positively correlated with the number of images in the sample image set; when the number of images in the sample image set is large, it can be considered that it is not necessary to add too many generated images to the training data, and in this case, the threshold can be set to a larger value; conversely, when the number of images in the sample image set is small, it can be considered that it is necessary to add more generated images to the training data, and in this case, the threshold can be set to a smaller value.
[0145] In a practical scenario, the selection probability is denoted as p, and the threshold is denoted as t. If the value of the overfitting parameter λ is greater than the threshold t, it can be considered that the discriminator of the generative adversarial network is overfitted, and the selection probability p can be increased by a certain step size to obtain the updated selection probability p. Otherwise, if the value of the overfitting parameter λ is less than or equal to the threshold t, it can be considered that the discriminator of the generative adversarial network is underfitted, and the selection probability p can be decreased by a certain step size to obtain the updated selection probability p.
[0146] After obtaining the updated selection probability p, the generated image G(z) can be fed into the training data of the generative adversarial network with probability p, thereby adaptively deceiving the discriminator. This alleviates the overfitting problem of the discriminator when training the generative adversarial network with limited training data, and helps to improve the image generation quality of the trained generative adversarial network.
[0147] As can be seen from the above description, the embodiments of this disclosure do not require additional regularization terms to process the generative adversarial network (GAN). Instead, they adaptively select images from the generated images based on the current overfitting degree of the discriminator, and use the selected images as training data to continue training the GAN. This achieves adaptive adjustment of the training data. Therefore, there is no need for fine manual adjustment of the GAN parameters. The process of selecting images from the generated images is independent of the weight parameters of the GAN, meaning that the training process of the GAN is insensitive to the weight parameters. Furthermore, for any image generation scenario and any training state, the training data can be adaptively enhanced based on the current overfitting degree of the discriminator to achieve the training of the GAN. Thus, the embodiments of this disclosure are applicable to various image generation scenarios and various training states.
[0148] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0149] Based on the image generation method proposed in the foregoing embodiments, this disclosure proposes an image generation apparatus.
[0150] Figure 5 This is a schematic diagram of the composition structure of the image generation apparatus according to an embodiment of the present disclosure, such as... Figure 5 As shown, the device may include: a first acquisition module 501 and a first processing module 502; wherein,
[0151] The first acquisition module 501 is used to acquire the original image;
[0152] The first processing module 502 is used to input the original image into a trained generative adversarial network (GAN) and process the original image using the trained GAN to obtain a first generated image. The training data of the GAN includes a set of sample images and a second generated image. The second generated image includes at least a portion of the generated image set. The generated image set represents the generated image obtained by processing the sample image set using the GAN.
[0153] In some embodiments, the first acquisition module 501 is further configured to:
[0154] Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network;
[0155] In the generated image set, obtain the number of second generated images that match the overfitting parameters.
[0156] In some embodiments, the first acquisition module 501 is specifically used for:
[0157] Obtain at least one of a first discrimination result and a second discrimination result; the first discrimination result represents the discrimination result corresponding to the sample image set, and the second discrimination result represents the discrimination result corresponding to the generated image set;
[0158] The overfitting parameters are obtained based on at least one of the first and second discrimination results.
[0159] In some embodiments, the first acquisition module 501 is configured to obtain the overfitting parameters based on at least one of the acquired first discrimination result and second discrimination result, including the following:
[0160] The first average value is used as the overfitting parameter, where the first average value represents the average value of the sign function of the logarithmic output of the first discrimination result;
[0161] The negative of the second average value is used as the overfitting parameter, where the second average value represents the average of the sign function of the logarithmic output of the second discrimination result;
[0162] Half of the difference between the first average and the second average is used as the overfitting parameter.
[0163] In some embodiments, the first acquisition module 501 is specifically used for:
[0164] Determine the selection probability, which represents the probability of selecting an image from the generated image set;
[0165] The selection probability is updated based on the value of the overfitting parameter to obtain the updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability.
[0166] Based on the updated selection probability, the second generated image, which matches the number of overfitting parameters, is selected from the generated image set.
[0167] In some embodiments, the first acquisition module 501 is configured to update the value of the selection probability based on the value of the overfitting parameter to obtain the updated selection probability, including the following:
[0168] If the value of the overfitting parameter is greater than a set threshold, the value of the selection probability is increased to obtain the updated selection probability;
[0169] If the value of the overfitting parameter is less than or equal to a set threshold, the value of the selection probability is reduced to obtain the updated selection probability.
[0170] In some embodiments, the first processing module 502 is further configured to obtain a preset selection probability; and select the second generated image from the generated image set according to the preset selection probability.
[0171] In practical applications, both the first acquisition module 501 and the first processing module 502 can be implemented using a processor in a computer device. The processor can be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.
[0172] Based on the neural network training method proposed in the foregoing embodiments, this disclosure proposes a neural network training device.
[0173] Figure 6 This is a schematic diagram of the composition structure of the neural network training device according to an embodiment of the present disclosure, as shown below. Figure 6As shown, the device may include: a second processing module 601, a second acquisition module 602, and a training module 603; wherein,
[0174] The second processing module 601 is used to input the sample image set into the generative adversarial network, and use the generative adversarial network to process the sample image set to obtain the generated image set.
[0175] The second acquisition module 602 is used to acquire a second generated image, the second generated image including at least a portion of the images in the generated image set;
[0176] The training module 603 is used to use the sample image set and the second generated image as training data for the generative adversarial network, and to train the generative adversarial network based on the training data.
[0177] In some embodiments, the second acquisition module 602 is specifically used for:
[0178] Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network;
[0179] In the generated image set, obtain the number of second generated images that match the overfitting parameters.
[0180] In some embodiments, the second acquisition module 602 is specifically used for:
[0181] Obtain at least one of a first discrimination result and a second discrimination result; the first discrimination result represents the discrimination result corresponding to the sample image set, and the second discrimination result represents the discrimination result corresponding to the generated image set;
[0182] The overfitting parameters are obtained based on at least one of the first and second discrimination results.
[0183] In some embodiments, the second acquisition module 602 is configured to obtain the overfitting parameters based on at least one of the acquired first discrimination result and second discrimination result, including the following:
[0184] The first average value is used as the overfitting parameter, where the first average value represents the average value of the sign function of the logarithmic output of the first discrimination result;
[0185] The negative of the second average value is used as the overfitting parameter, where the second average value represents the average of the sign function of the logarithmic output of the second discrimination result;
[0186] Half of the difference between the first average and the second average is used as the overfitting parameter.
[0187] In some embodiments, the second acquisition module 602 is specifically used for:
[0188] Determine the selection probability, which represents the probability of selecting an image from the generated image set;
[0189] The selection probability is updated based on the value of the overfitting parameter to obtain the updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability.
[0190] Based on the updated selection probability, the second generated image, which matches the number of overfitting parameters, is selected from the generated image set.
[0191] In some embodiments, the second acquisition module 602 is configured to update the value of the selection probability based on the value of the overfitting parameter to obtain an updated selection probability, including the following:
[0192] If the value of the overfitting parameter is greater than a set threshold, the value of the selection probability is increased to obtain the updated selection probability; if the value of the overfitting parameter is less than or equal to the set threshold, the value of the selection probability is decreased to obtain the updated selection probability.
[0193] In some embodiments, the second acquisition module 602 is specifically used to acquire a preset selection probability; and select the second generated image from the generated image set according to the preset selection probability.
[0194] Furthermore, in this embodiment, the functional modules 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 module.
[0195] If the integrated unit is implemented as a software functional module and not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, 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, server, or network device, etc.) or processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0196] Specifically, the computer program instructions corresponding to an image generation method or a neural network training method in this embodiment can be stored on storage media such as optical discs, hard disks, and USB flash drives. When the computer program instructions corresponding to an image generation method or a neural network training method in the storage medium are read or executed by an electronic device, any one of the image generation methods or neural network training methods in the foregoing embodiments is implemented.
[0197] Based on the same technical concept as the foregoing embodiments, see Figure 7 This illustrates an electronic device 70 provided in an embodiment of the present disclosure, which may include: a memory 701 and a processor 702; wherein,
[0198] The memory 701 is used to store computer programs and data;
[0199] The processor 702 is used to execute the computer program stored in the memory to implement any of the image generation methods or neural network training methods in the foregoing embodiments.
[0200] In practical applications, the memory 701 described above can be volatile memory, such as RAM; or non-volatile memory, such as ROM, flash memory, hard disk drive (HDD) or solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor 702.
[0201] The processor 802 described above can be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor. It is understood that, for different devices, the electronic device used to implement the above processor function can also be other types, and this disclosure does not specifically limit the embodiments.
[0202] This disclosure also provides a computer program including computer-readable code, which, when executed in an electronic device, causes a processor in the electronic device to execute an image generation method or a neural network training method described above.
[0203] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0204] The description of the various embodiments above tends to emphasize the differences between them. Similarities or commonalities can be referenced interchangeably, and for the sake of brevity, will not be repeated here.
[0205] The methods disclosed in the various method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0206] The features disclosed in the various product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0207] The features disclosed in the various method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.
[0208] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0209] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.
Claims
1. An image generation method, characterized in that, The method includes: Obtain the original image; The original image is input into a trained generative adversarial network (GAN), and the trained GAN processes the original image to obtain a first generated image. The training data of the GAN includes a set of sample images and a second generated image. The second generated image includes at least a portion of the generated image set. The generated image set represents the generated image obtained by processing the sample image set using the GAN. The method further includes: Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network; A selection probability is determined, which represents the probability of selecting an image from the generated image set; the selection probability is updated based on the value of the overfitting parameter to obtain an updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability; based on the updated selection probability, a second generated image matching the number of overfitting parameters is selected from the generated image set.
2. The method according to claim 1, characterized in that, The process of obtaining overfitting parameters includes: Obtain at least one of a first discrimination result and a second discrimination result; the first discrimination result represents the discrimination result corresponding to the sample image set, and the second discrimination result represents the discrimination result corresponding to the generated image set; The overfitting parameters are obtained based on at least one of the first and second discrimination results.
3. The method according to claim 2, characterized in that, The overfitting parameters are obtained based on at least one of the first and second discrimination results, including the following: The first average value is used as the overfitting parameter, where the first average value represents the average value of the sign function of the logarithmic output of the first discrimination result; The negative of the second average value is used as the overfitting parameter, where the second average value represents the average of the sign function of the logarithmic output of the second discrimination result; Half of the difference between the first average and the second average is used as the overfitting parameter.
4. The method according to claim 1, characterized in that, The step of updating the selection probability based on the value of the overfitting parameter to obtain the updated selection probability includes the following: If the value of the overfitting parameter is greater than a set threshold, the value of the selection probability is increased to obtain the updated selection probability; If the value of the overfitting parameter is less than or equal to a set threshold, the value of the selection probability is reduced to obtain the updated selection probability.
5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Obtain a preset selection probability; select the second generated image from the generated image set according to the preset selection probability.
6. A neural network training method, characterized in that, The method includes: The sample image set is input into the generative adversarial network, and the generative adversarial network is used to process the sample image set to obtain the generated image set. Obtain a second generated image, the second generated image comprising at least a portion of the images in the generated image set; The sample image set and the second generated image are used as training data for the generative adversarial network, and the generative adversarial network is trained based on the training data. The process of obtaining the second generated image includes: Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network; Determine the selection probability, which represents the probability of selecting an image from the generated image set; The selection probability is updated based on the value of the overfitting parameter to obtain the updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability. Based on the updated selection probability, the second generated image, which matches the number of overfitting parameters, is selected from the generated image set.
7. The method according to claim 6, characterized in that, The process of obtaining overfitting parameters includes: Obtain at least one of a first discrimination result and a second discrimination result; the first discrimination result represents the discrimination result corresponding to the sample image set, and the second discrimination result represents the discrimination result corresponding to the generated image set; The overfitting parameters are obtained based on at least one of the first and second discrimination results.
8. The method according to claim 7, characterized in that, The overfitting parameters are obtained based on at least one of the first and second discrimination results, including the following: The first average value is used as the overfitting parameter, where the first average value represents the average value of the sign function of the logarithmic output of the first discrimination result; The negative of the second average value is used as the overfitting parameter, where the second average value represents the average of the sign function of the logarithmic output of the second discrimination result; Half of the difference between the first average and the second average is used as the overfitting parameter.
9. The method according to claim 6, characterized in that, The step of updating the selection probability based on the value of the overfitting parameter to obtain the updated selection probability includes the following: If the value of the overfitting parameter is greater than a set threshold, the value of the selection probability is increased to obtain the updated selection probability; if the value of the overfitting parameter is less than or equal to the set threshold, the value of the selection probability is decreased to obtain the updated selection probability.
10. The method according to any one of claims 6 to 9, characterized in that, The process of obtaining the second generated image includes: Obtain a preset selection probability; select the second generated image from the generated image set according to the preset selection probability.
11. An electronic device, characterized in that, Includes a processor and memory for storing computer programs that can run on the processor; wherein, The processor is used to run the computer program to perform the image generation method; The image generation method includes: Obtain the original image; The original image is input into a trained generative adversarial network (GAN), and the trained GAN processes the original image to obtain a first generated image. The training data of the GAN includes a set of sample images and a second generated image. The second generated image includes at least a portion of the generated image set. The generated image set represents the generated image obtained by processing the sample image set using the GAN. The image generation method further includes: Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network; A selection probability is determined, which represents the probability of selecting an image from the generated image set; the selection probability is updated based on the value of the overfitting parameter to obtain an updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability; based on the updated selection probability, a second generated image matching the number of overfitting parameters is selected from the generated image set.
12. An electronic device, characterized in that, Includes a processor and memory for storing computer programs that can run on the processor; wherein, The processor is used to run the computer program to execute a neural network training method; The neural network training method includes: The sample image set is input into the generative adversarial network, and the generative adversarial network is used to process the sample image set to obtain the generated image set. Obtain a second generated image, the second generated image comprising at least a portion of the images in the generated image set; The sample image set and the second generated image are used as training data for the generative adversarial network, and the generative adversarial network is trained based on the training data. The process of obtaining the second generated image includes: Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network; A selection probability is determined, which represents the probability of selecting an image from the generated image set; the selection probability is updated based on the value of the overfitting parameter to obtain an updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability; based on the updated selection probability, a second generated image matching the number of overfitting parameters is selected from the generated image set.
13. A computer storage medium having a computer program stored thereon, characterized in that, When this computer program is executed by the processor, it implements an image generation method; The image generation method includes: Obtain the original image; The original image is input into a trained generative adversarial network (GAN), and the trained GAN processes the original image to obtain a first generated image. The training data of the GAN includes a set of sample images and a second generated image. The second generated image includes at least a portion of the generated image set. The generated image set represents the generated image obtained by processing the sample image set using the GAN. The image generation method further includes: Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network; A selection probability is determined, which represents the probability of selecting an image from the generated image set; the selection probability is updated based on the value of the overfitting parameter to obtain an updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability; based on the updated selection probability, a second generated image matching the number of overfitting parameters is selected from the generated image set.
14. A computer storage medium having a computer program stored thereon, characterized in that, This computer program implements a neural network training method when executed by a processor. The neural network training method includes: The sample image set is input into the generative adversarial network, and the generative adversarial network is used to process the sample image set to obtain the generated image set. Obtain a second generated image, the second generated image comprising at least a portion of the images in the generated image set; The sample image set and the second generated image are used as training data for the generative adversarial network, and the generative adversarial network is trained based on the training data. The process of obtaining the second generated image includes: Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network; A selection probability is determined, which represents the probability of selecting an image from the generated image set; the selection probability is updated based on the value of the overfitting parameter to obtain an updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability; based on the updated selection probability, a second generated image matching the number of overfitting parameters is selected from the generated image set.
15. A computer program product comprising computer-readable code, wherein when the computer-readable code is executed in an electronic device, a processor in the electronic device performs an image generation method; The image generation method includes: Obtain the original image; The original image is input into a trained generative adversarial network (GAN), and the trained GAN processes the original image to obtain a first generated image. The training data of the GAN includes a set of sample images and a second generated image. The second generated image includes at least a portion of the generated image set. The generated image set represents the generated image obtained by processing the sample image set using the GAN. The image generation method further includes: Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network; A selection probability is determined, which represents the probability of selecting an image from the generated image set; the selection probability is updated based on the value of the overfitting parameter to obtain an updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability; based on the updated selection probability, a second generated image matching the number of overfitting parameters is selected from the generated image set.
16. A computer program product comprising computer-readable code, wherein when the computer-readable code is run in an electronic device, a processor in the electronic device executes a method for implementing a neural network training method; The neural network training method includes: The sample image set is input into the generative adversarial network, and the generative adversarial network is used to process the sample image set to obtain the generated image set. Obtain a second generated image, the second generated image comprising at least a portion of the images in the generated image set; The sample image set and the second generated image are used as training data for the generative adversarial network, and the generative adversarial network is trained based on the training data. The process of obtaining the second generated image includes: Obtain overfitting parameters, which characterize the degree of overfitting of the discriminator in the generative adversarial network; A selection probability is determined, which represents the probability of selecting an image from the generated image set; the selection probability is updated based on the value of the overfitting parameter to obtain an updated selection probability; the value of the overfitting parameter is positively correlated with the updated selection probability; based on the updated selection probability, a second generated image matching the number of overfitting parameters is selected from the generated image set.
Citation Information
Patent Citations
Neural network training method and device and image generation method and device
CN110634167A