An optimization method for unconditional generative models based on generative adversarial networks

By introducing consistent latent representation loss and reconstruction loss into the generative adversarial network, optimizing the parameters of the generator and the discriminator solves the problem of difficulty in achieving dynamic balance during the training process, improves the stability and image quality of the generative adversarial network, and enhances The generalization ability of the model.

CN118520911BActive Publication Date: 2024-10-22TIANJIN YIDAO AUTOMATION EQUIP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410985080.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-10-22
Estimated Expiration
2044-07-23

AI Technical Summary

Technical Problem

During the training process of generative adversarial networks, it is difficult to achieve a dynamic balance between the generator and the discriminator, which makes the training difficult to balance and the results unstable. It is also prone to gradient disappearance or explosion problems, which affects the diversity and quality of generated samples.

Method used

By introducing consistent latent representation loss and reconstruction loss, the training process of the generative adversarial network is optimized, and the interaction between the generator and the discriminator is used to enhance the stability of the model and the quality of the generated images. The specific steps include building a training set, data preprocessing, Train a generative adversarial network model, compute consistent latent representation loss and reconstruction loss, and update model parameters.

Benefits of technology

It effectively improves the training stability and image generation quality of the generative adversarial network, improves the generalization ability of the model, and is suitable for fields such as image generation, editing, and style conversion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118520911B_ABST
    Figure CN118520911B_ABST
Patent Text Reader

Abstract

The present invention relates to an optimization method for an unconditional generative model based on a generative adversarial network, which includes constructing a training set containing real and generated images and performing data preprocessing; training a preliminary generative adversarial network model, including a generator G with a function of generating images and a discriminator D with a function of distinguishing between real images and generated images; using the potential code generated by the generator G, reconstructing it through the discriminator D to obtain the reconstructed potential code, and calculating the consistent potential representation loss; reconstructing the real image using the generator G, calculating the reconstruction loss, and updating the parameters of the generator G and the discriminator D through the two additional loss terms; and looping through the above steps until the model converges. The present invention significantly improves the stability of the training process by introducing a consistent potential representation and reconstruction mechanism, while improving the diversity and fidelity of the generated images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of deep learning and computer vision, and in particular to an optimization method for an unconditional generative model based on a generative adversarial network. Background Art

[0002] As an important part of modern computer vision and machine learning, generative models have shown wide application potential in image generation, video editing, style transfer and even drug discovery. In particular, generative adversarial networks have attracted widespread attention for their outstanding ability to generate realistic images. Generative adversarial networks generate highly realistic images by simulating data distribution, which not only promotes the development of computer vision, but also opens up new horizons for artistic creation and the entertainment industry. As the application of generative models in drug discovery, unsupervised learning, and data augmentation continues to expand, their potential in solving practical problems is gradually emerging. Generative models are in rapid development and are expected to show their revolutionary impact in more fields in the future.

[0003] The training process of generative adversarial networks is recognized to be challenging and unstable because it involves a confrontational game between the generator and the discriminator. In some cases, the generator starts to generate samples of very few types and ignores other parts of the data distribution. This means that the diversity of the generated samples is reduced and cannot cover the distribution of real data. At the same time, the training process of generative adversarial networks often encounters instability, which manifests as oscillation, divergence or difficulty in convergence of the loss function. This is mainly because the dynamic balance between the generator and the discriminator is difficult to achieve. In the training process of generative adversarial networks, the problem of gradient disappearance or explosion also often occurs, especially when the model structure is complex or the diversity of training data is large. This will cause the update step of the generator or discriminator to be invalid, thus affecting the overall training process. To address these challenges, researchers have proposed various methods and techniques, such as introducing more stable training strategies, improved loss functions, and using data augmentation methods, to enhance the stability of generative adversarial networks and the quality of generated samples.

[0004] The goal of the present invention is to improve the fairness and stability of training. The present invention proposes a new perspective and method to improve the training process of generative adversarial networks through consistent latent representation and reconstruction. The method of the present invention aims to improve the quality and diversity of images generated by generative adversarial networks by narrowing the distance between the generator and the discriminator, while providing an effective unsupervised training method for downstream tasks. Summary of the invention

[0005] The purpose of the present invention is to provide an optimization method for an unconditional generative model based on a generative adversarial network, aiming to solve the problem that in the process of training a generative adversarial network, the dynamic balance between the generator and the discriminator is difficult to achieve, resulting in difficult training balance and unstable training results.

[0006] To achieve the above object, the present invention provides the following technical solutions:

[0007] An optimization method for an unconditional generative model based on a generative adversarial network comprises the following steps:

[0008] S100, construct a training set containing real and generated images, and perform data preprocessing;

[0009] S200, training a preliminary generative adversarial network model, including a generator G having a function of generating images and a discriminator D having a function of distinguishing between real images and generated images;

[0010] S300, using the potential code generated by the generator G, reconstructing it through the discriminator D to obtain the reconstructed potential code, and calculating the consistent potential representation loss;

[0011] S400, reconstructing the real image using the generator G, calculating the reconstruction loss, and updating the parameters of the generator G and the discriminator D through the consistent potential representation loss and the reconstruction loss to achieve more stable and high-quality image generation;

[0012] S500, executing the above steps repeatedly until the model converges.

[0013] As a further technical solution of the present invention, step S100 includes the following steps:

[0014] S110, normalize the original data set and scale the pixel values ​​of the input image to the interval [0,1] using the formula:

[0015] ;

[0016] Where P represents the normalized pixel value, Represents the size of the pixel value before normalization. Min(P) and max(P) represent the minimum and maximum pixel values ​​in the entire image, respectively.

[0017] S120, performing data enhancement operation on the normalized image, wherein the enhancement operation includes randomly rotating, translating, scaling and flipping the image, and then center-cropping the image and adjusting the size to a fixed resolution of 256x256 to obtain a training set.

[0018] We adopt specific data preprocessing strategies for different roles in the generative adversarial network, the generator and the discriminator. For the generator, we generate new data samples by sampling from a random noise distribution. These noise data are used as the input of the generator to learn to map to the true distribution of the data. For the discriminator, in addition to traditional image data preprocessing, a key processing step is introduced - output regularization of the feature extraction layer to reduce the gradient explosion or vanishing problem during training. By combining the above data preprocessing methods, the consistency and quality of the input data are guaranteed.

[0019] As a further technical solution of the present invention, step S200 includes the following steps:

[0020] First, select a suitable network architecture, build a generator and a discriminator, and initialize the random parameters of the generator and discriminator networks to provide a starting point for the training process. Then select a suitable optimizer to update the weights and biases of the network to minimize the loss function. The loss function of the network during training is:

[0021] ;

[0022] In the formula, Represents the objective function of the optimization problem of the generative adversarial network; Represents the distribution of real data; represents the distribution of the noise signal; x represents the real sample of the input. , D(x)=1, Maximum, D(x) represents the probability that x is the real data, represents the mathematical expectation of the real data; z represents random noise. , D(G(z))=0, Maximum, G(z) represents the output of the generative model;

[0023] During the training process, the generator and discriminator are trained alternately. First, the generator is fixed and the discriminator is updated to make it better at distinguishing between real and generated images. Then, the discriminator is fixed and the generator is updated to make the images it generates more difficult for the discriminator to distinguish. This is repeated until the model reaches the preset number of training rounds or the model performance is no longer significantly improved.

[0024] As a further technical solution of the present invention, step S300 includes the following steps:

[0025] The aim is to enhance the stability of the model and the quality of generated images through the interaction between the generator G and the discriminator D. First, the generator G is used to generate images from random noise. In this process, the generator G maps random noise into complex image data to simulate the distribution of real images;

[0026] Next, the image generated by the generator G is input into the discriminator D. Different from the traditional generative adversarial network training, the discriminator D not only judges the authenticity of the image in this step, but is also responsible for reconstructing the potential code corresponding to the input image. This reconstruction process involves extracting effective feature representations from high-dimensional image data and reflecting them in the latent space. In order to ensure the consistency between the latent code of the generated image and the reconstructed latent code, it is necessary to calculate the consistent latent representation loss. The loss function of the consistent latent representation loss is:

[0027] ;

[0028] In the formula represents the true latent space representation, represents the latent space representation extracted by the discriminator, represents the distance measure between two variables. It represents the loss function calculated by the trained generative adversarial network model when performing latent space consistency representation. In the present invention, L1 distance is used as the distance metric.

[0029] As a further technical solution of the present invention, step S400 includes the following steps:

[0030] First, select images from the real image dataset as input, and reconstruct these real images through the generator; in this process, the real images are first encoded into latent codes, and then these latent codes are used to generate images again; the reconstructed images should be as close as possible to the original real images to evaluate the performance of the generator. For each pair of original real images and images reconstructed by the generator, we calculate the difference between them as the reconstruction loss, which can be measured by a variety of loss functions, such as L1 loss or L2 loss. The reconstruction loss reflects the ability of the generator in restoring the real image, that is, the smaller the reconstruction loss, the better the performance of the generator. The loss function of the reconstruction loss is expressed as:

[0031] ;

[0032] In the formula Represents a real picture. represents the image reconstructed by the generator, It represents the loss function calculated by the trained generative adversarial network model when reconstructing images.

[0033] As a further technical solution of the present invention, in step S500, the following steps are included:

[0034] The above-mentioned loss function is optimized, and the gradients of the generator and discriminator parameters corresponding to the loss function are:

[0035] ;

[0036] It ensures that the discriminator assigns a higher authenticity score to the real picture, and at the same time, encourages the discriminator to assign a lower authenticity score to the generated picture, and implements a mechanism to reduce the difference between the feature representation extracted by the discriminator and the feature representation of the real picture; the above formula represents the process of the discriminator trying to maximize the authenticity of the real image and minimize the consistency loss of the latent space;

[0037] ;

[0038] It encourages the generator to produce images that are closer to real pictures, thereby obtaining a higher authenticity score at the discriminator. It introduces a strategy to reduce the structural or content differences between the generated pictures and the corresponding real samples, thereby improving the realism of the generated images.

[0039] represents the gradient of the discriminator during the optimization process, represents the gradient of the discriminator training process, Represents the gradient obtained by the discriminator for latent space alignment; represents the gradient of the generator during the optimization process, Represents the gradient generated by the discriminator to judge the generated image, Represents the gradient produced by the generator through reconstruction of the latent space code.

[0040] As a further technical solution of the present invention, the network framework of the generator and the discriminator is StyleGAN2.

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

[0042] (1) Enhanced stability: By introducing two additional loss terms, namely, consistent latent representation loss and reconstruction loss, the present invention effectively improves the training stability of the generative adversarial network.

[0043] (2) Improved image quality: The present invention directly improves the generator’s ability to learn the distribution of real images by reconstructing the real images and optimizing the reconstruction loss.

[0044] (3) Better model generalization ability: The method of the present invention helps to improve the generalization ability of the model to unseen data by enforcing consistency in the latent space and optimizing the model through reconstruction of real images.

[0045] (4) Wide application potential: Due to the remarkable effect of the present invention in improving the stability and image quality of generative adversarial networks, it can be widely used in image generation, image editing, image style transfer, data enhancement, and other fields that require high-quality image generation.

[0046] (5) Simple and efficient implementation method: The present invention can achieve the above advantages by simply modifying the loss function and introducing additional loss terms, without making major modifications to the existing generative adversarial network architecture, thereby ensuring the ease of implementation and efficiency of the method. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a flow chart of an unconditional generative model optimization method based on generative adversarial networks.

[0048] Figure 2 It is a training architecture diagram of an unconditional generative model optimization method based on a generative adversarial network. DETAILED DESCRIPTION

[0049] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the advantages of the present invention will be further illustrated by comparing the embodiments in combination with the accompanying drawings and specific implementation methods.

[0050] See also Figure 1 and Figure 2 The embodiment of the present invention provides an optimization method for an unconditional generative model based on a generative adversarial network, comprising the following steps:

[0051] S100, construct a training set containing real and generated images, and perform data preprocessing;

[0052] S110, normalize the original data set and scale the pixel values ​​of the input image to the interval [0,1] using the formula:

[0053] ;

[0054] Where P represents the normalized pixel value, Represents the size of the pixel value before normalization, min(P) and max(P) represent the minimum pixel value and the maximum pixel value in the entire image respectively;

[0055] Ensure the quality and consistency of input data to improve the stability of the training process and the quality of generated images.

[0056] S120, performing data enhancement operation on the normalized image, wherein the enhancement operation includes randomly rotating, translating, scaling and flipping the image, and then center-cropping the image and adjusting the size to a fixed resolution of 256x256 to obtain a training set.

[0057] Increase the diversity of training data to prevent model overfitting.

[0058] We adopt specific data preprocessing strategies for different roles in the generative adversarial network, the generator and the discriminator. For the generator, we generate new data samples by sampling from a random noise distribution. These noise data are used as the input of the generator to learn to map to the true distribution of the data. For the discriminator, in addition to traditional image data preprocessing, a key processing step is introduced - output regularization of the feature extraction layer to reduce the gradient explosion or vanishing problem during training. By combining the above data preprocessing methods, the consistency and quality of the input data are guaranteed.

[0059] S200, training a preliminary generative adversarial network model, including a generator G having a function of generating images and a discriminator D having a function of distinguishing between real images and generated images;

[0060] First, select a suitable network architecture to build a generator and a discriminator. The network framework of the generator and the discriminator is StyleGAN2. Initialize the random parameters of the generator and the discriminator network to provide a starting point for the training process. Then select a suitable optimizer to update the weights and biases of the network to minimize the loss function. The loss function of the network during training is:

[0061] ;

[0062] In the formula, Represents the objective function of the optimization problem of the generative adversarial network; Represents the distribution of real data; represents the distribution of the noise signal; x represents the real sample of the input. , D(x)=1, Maximum, D(x) represents the probability that x is the real data, represents the mathematical expectation of the real data; z represents random noise. , D(G(z))=0, Maximum, G(z) represents the output of the generative model;

[0063] During the training process, the generator and the discriminator are trained alternately; first, the generator is fixed and the discriminator is updated to make it better at distinguishing between real and generated images; then the discriminator is fixed and the generator is updated to make it more difficult for the discriminator to distinguish the images it generates; through repeated iterations, the model reaches the preset number of training rounds or the model performance is no longer significantly improved; the purpose of this step is to train a generator that can initially generate images with a certain degree of authenticity, and a discriminator that can effectively distinguish between real and generated images, laying the foundation for subsequent optimization and application. Through this process, the model learns the ability to generate images from random noise and the ability to judge the authenticity of images, which makes it possible to further improve the model performance and application scope in subsequent steps.

[0064] S300, using the potential code generated by the generator G, reconstructing it through the discriminator D to obtain the reconstructed potential code, and calculating the consistent potential representation loss;

[0065] The aim is to enhance the stability of the model and the quality of generated images through the interaction between the generator G and the discriminator D. First, the generator G is used to generate images from random noise. In this process, the generator G maps random noise into complex image data to simulate the distribution of real images;

[0066] Next, the image generated by the generator G is input into the discriminator D. Different from the traditional generative adversarial network training, the discriminator D in this step not only judges the authenticity of the image, but is also responsible for reconstructing the latent code corresponding to the input image. This reconstruction process involves extracting effective feature representations from high-dimensional image data, which are reflected in the latent space. In order to ensure the consistency between the latent code of the generated image and the reconstructed latent code, it is necessary to calculate the consistent latent representation loss. This loss function measures the difference between the original latent code of the generated image and the latent code reconstructed by the discriminator D. By minimizing this loss, the model is guided to make the reconstructed latent code as close to the original latent code as possible, thereby enhancing the stability and consistency of the generated image. The loss function of the consistent latent representation loss is;

[0067] ;

[0068] In the formula represents the true latent space representation, represents the latent space representation extracted by the discriminator, represents the distance measure between two variables. It represents the loss function calculated by the trained generative adversarial network model when performing latent space consistency representation. In the present invention, L1 distance is used as the distance metric.

[0069] S400, reconstructing the real image using the generator G, calculating the reconstruction loss, and updating the parameters of the generator G and the discriminator D through the consistent potential representation loss and the reconstruction loss to achieve more stable and high-quality image generation;

[0070] First, select images from the real image dataset as input, and try to reconstruct these real images through the generator; in this process, the real images are first encoded into latent codes, and then these latent codes are used to generate images again; the reconstructed images should be as close to the original real images as possible to evaluate the performance of the generator. For each pair of original real images and images reconstructed by the generator, we calculate the difference between them as the reconstruction loss, which can be measured by a variety of loss functions, such as L1 loss or L2 loss. The reconstruction loss reflects the ability of the generator in restoring the real image, that is, the smaller the reconstruction loss, the better the performance of the generator. The loss function of the reconstruction loss is expressed as:

[0071] ;

[0072] In the formula Represents a real picture. represents the image reconstructed by the generator, It represents the loss function calculated by the trained generative adversarial network model when reconstructing images;

[0073] Incorporating the above steps into the training process of the Generative Adversarial Network can significantly improve the quality and authenticity of the generated images, while also enhancing the training stability of the model. The introduction of reconstruction loss and consistent latent representation loss enables the generator to not only generate realistic images, but also accurately reconstruct real images, thereby further optimizing the performance of the Generative Adversarial Network model.

[0074] S500, looping through the above steps until the model converges;

[0075] The above-mentioned loss function is optimized, and the gradients of the generator and discriminator parameters corresponding to the loss function are:

[0076] ;

[0077] It ensures that the discriminator assigns a higher authenticity score to real images, and at the same time, encourages the discriminator to assign a lower authenticity score to generated images, and implements a mechanism to reduce the difference between the feature representation extracted by the discriminator and the feature representation of the real image;

[0078] ;

[0079] It encourages the generator to produce images that are closer to real pictures, thereby obtaining a higher authenticity score at the discriminator. It introduces a strategy to reduce the structural or content differences between the generated pictures and the corresponding real samples, thereby improving the realism of the generated images.

[0080] represents the gradient of the discriminator during the optimization process, represents the gradient of the discriminator training process, Represents the gradient obtained by the discriminator for latent space alignment; represents the gradient of the generator during the optimization process, Represents the gradient generated by the discriminator to judge the generated image, Represents the gradient produced by the generator through reconstruction of the latent space code.

[0081] Load the saved weights into the generator and discriminator;

[0082] ;

[0083] ;

[0084] in and Represent the weight sets of the generator and the discriminator respectively;

[0085] Randomly generate latent space codes and use the random number generation function of Pytorch to generate random latent space codes:

[0086] ;

[0087] Here, z represents the latent space code randomly sampled from a multidimensional normal distribution, and p(z) is the distribution of the latent space, which is usually a multidimensional normal distribution with mean 0 and variance I.

[0088] The latent space code is fed into the generator, which uses the latent space code to generate images.

[0089] S600: Input the feature map of the image to be generated into the trained generator, input the trained model weight information into the generator to generate the image required for the target, and save the image in the form of a file.

[0090] The present invention provides an optimization method for an unconditional generative model based on a generative adversarial network. The present invention is further illustrated by taking the generation of a church picture as an example in the following embodiment, and the method comprises the following steps:

[0091] 1. Get a large-scale scene understanding dataset for training, scientifically named "LSUN-Church". The Large-Scale Scene Understanding (LSUN) challenge aims to provide different benchmarks for large-scale scene classification and understanding. The LSUN classification dataset contains 10 scene categories, such as restaurants, bedrooms, outdoor churches, etc. For training data, each category contains a large number of images, ranging from about 120,000 to 3,000,000. The validation data includes 300 images, and the test data for each category has 1,000 images. Here, we get pictures of outdoor churches.

[0092] 2. First, the pixel values ​​of the input image are normalized to between [-1, 1], and then the images in the training set are subjected to data augmentation, including random rotation, translation, scaling, flipping, etc. Next, the images are center-cropped and resized to a fixed resolution of 256x256. These transformations can not only expand the diversity of the data set, but also simulate images under different perspectives and conditions, improving the model's ability to adapt to new data.

[0093] 3. Establish a potential consistent generative adversarial network model. The model includes a generator and a discriminator. Here we use StyleGAN2 as the generator and discriminator. For the generator and discriminator we established, we use the loss of the generative adversarial network proposed above for optimization:

[0094]

[0095] In the formula, V(D,G) represents the objective function of the optimization problem of the generative adversarial network. The best discriminant model is to maximize V(D,G), while the best generative model is to minimize V(D,G). The essence of the generative adversarial network is to learn the data distribution, and finally get the zero-sum game problem of two identical data distributions.

[0096] 4. Input the images in the data set into the generator G respectively, and the generator G uses the data distribution it has learned to generate new images. Then, these generated images and the original images will be sent to the discriminator D. The task of the discriminator D is to distinguish whether the input image is generated by the generator G or a real image from the original data set. Through this process, both the generator G and the discriminator D will continue to learn and adjust to achieve higher generation quality and discrimination accuracy. In addition, in order to further optimize the quality of the generated images, we also introduce the concepts of reconstruction loss and consistency loss to ensure that the generated images are not only visually pleasing, but also highly consistent with the original images in structure and content. Through continuous iterative training, the present invention aims to improve the performance of generative adversarial networks in image generation tasks, especially in maintaining the authenticity and diversity of images.

[0097] 5. Generate new church images using the trained generative adversarial network. You can generate church images of various styles by generating different latent codes. Save the generated data in the form of images to get the final generated result image.

[0098] The present invention proposes an unconditional generative model optimization method based on a generative adversarial network, and introduces potential consistency representation and image reconstruction technology to optimize the unconditional generation ability of the model. Advanced random number generation technology is used to optimize the representation of the latent space, and richer image features are captured through high-dimensional space encoding, providing a better basis for generating high-quality images. Not only does the latent space code generate new images, but the present invention also introduces an image reconstruction mechanism to further optimize the performance of the model by minimizing the difference between the generated image and the real image. The method proposed in the present invention not only optimizes the image generation process, but also utilizes the unconditional generation characteristics of the generative adversarial network to improve the generation ability of the model when there is no clear conditional input, and broadens the scope of application. These innovations not only improve the quality of the generated images, but also enhance the stability and generalization ability of the model, opening up new paths for the research and application of generative adversarial networks.

[0099] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.

Claims

1. An optimization method for unconditional generative models based on generative adversarial networks, It is characterized in that The following steps are included: S100, construct a training set containing real and generated images, and perform data preprocessing; S200, training a preliminary generative adversarial network model, including a generator G having a function of generating images and a discriminator D having a function of distinguishing between real images and generated images; S300, using the potential code generated by the generator G, reconstructing it through the discriminator D to obtain the reconstructed potential code, and calculating the consistent potential representation loss; S400, reconstructing the real image using the generator G, calculating the reconstruction loss, and updating the parameters of the generator G and the discriminator D through the consistent potential representation loss and the reconstruction loss; S500, looping through the above steps until the model converges; Step S300 includes the following steps: First, use the generator G to generate images from random noise; Next, the image generated by the generator G is input into the discriminator D to calculate the consistent latent representation loss. The loss function of the consistent latent representation loss is: ; In the formula represents the true latent space representation, represents the latent space representation extracted by the discriminator, represents the distance measure between two variables. It represents the loss function calculated by the trained generative adversarial network model when performing consistent representation of the latent space; Step S400 includes the following steps: First, select images from the real image dataset as input and reconstruct the real image through the generator; for each pair of the original real image and the image reconstructed by the generator, calculate the difference between them as the reconstruction loss, and the loss function of the reconstruction loss is expressed as: ; In the formula Represents a real picture. represents the image reconstructed by the generator, It represents the loss function calculated by the trained generative adversarial network model when reconstructing images; In step S500, the following steps are included: The loss function is optimized, and the gradients of the generator and discriminator parameters corresponding to the loss function are: ; ; represents the gradient of the discriminator during the optimization process, represents the gradient of the discriminator training process, Represents the gradient obtained by the discriminator for latent space alignment; represents the gradient of the generator during the optimization process, Represents the gradient generated by the discriminator to judge the generated image, Represents the gradient produced by the generator through reconstruction of the latent space code.

2. The optimization method of an unconditional generative model based on a generative adversarial network as claimed in claim 1, It is characterized in that Step S100 includes the following steps: S110, normalize the original data set and scale the pixel values ​​of the input image to the interval [0,1] using the formula: ; Where P represents the normalized pixel value, Represents the size of the pixel value before normalization. Min(P) and max(P) represent the minimum and maximum pixel values ​​in the entire image, respectively. S120, performing data enhancement operation on the normalized image, wherein the enhancement operation includes randomly rotating, translating, scaling and flipping the image, and then center-cropping the image and adjusting the size to a fixed resolution of 256x256 to obtain a training set.

3. The optimization method of an unconditional generative model based on a generative adversarial network as claimed in claim 1, It is characterized in that Step S200 includes the following steps: First, select a suitable network architecture, build a generator and a discriminator, and initialize the random parameters of the generator and discriminator networks to provide a starting point for the training process. Then select a suitable optimizer to update the weights and biases of the network to minimize the loss function. The loss function of the network during training is: ; In the formula, Represents the objective function of the generative adversarial network optimization problem; Represents the distribution of real data; represents the distribution of the noise signal; x represents the real sample of the input. , D(x)=1, Maximum, D(x) represents the probability that x is the real data, represents the mathematical expectation of the real data; z represents random noise. , D(G(z))=0, Maximum, G(z) represents the output of the generative model; During the training process, the generator and discriminator are trained alternately; first, the generator is fixed and the discriminator is updated; then the discriminator is fixed and the generator is updated; through repeated iterations, the model reaches the preset number of training rounds.

4. The optimization method of an unconditional generative model based on a generative adversarial network as claimed in claim 1, It is characterized in that The network architecture of the generator and discriminator is StyleGAN2.