Improvement and Application of Generative Adversarial Networks Algorithm Based on Transfer Learning

. Generative adversarial networks are currently used to solve various problems and are one of the most popular models. Generator and discriminator are characteristics of continuous game process in training. While improving the quality of generated pictures, it will also make it diﬃcult for the loss function to be stable, and the training speed will be extremely slow compared with other methods. In addition, since the generative adversarial networks directly learns the data distribution of samples, the model will become uncontrollable and the freedom of the model will become too large when the original data distribution is constantly approximated. A new transfer learning training idea for the unsupervised generation model is proposed based on the generation network. The decoder of trained variational autoencoders is used as the network architecture and parameters to generative adversarial network generator. In addition, the standard normal distribution is obtained by sampling and then input into the model to control the degree of freedom of the model. Finally, we evaluated our method on using the MNIST, CIFAR10, and LSUN datasets. The experiment shows that our proposed method can make the loss function converge as quickly as possible and increase the model accuracy.


Introduction
GAN is a new image-generating model based on game theory, which innovatively combines the generative model and adversarial model, and proposes a useful training method based on model features to make the output resulting images clearer and sharper than other methods.
Compared with the previous complex image generation methods, the generation of adversarial network does not need to model its original dataset, but only needs to use generators to approach the original data distribution.Its generator and discriminator also do not need complex network structure, and the original deep neural network can achieve better generation effect.Although researchers have made a lot of improvements to the generation of adversarial network, there are still some points that need to be improved based on its own characteristics.For example, the model training speed is slow and the model freedom is too large.So, the purpose of our study is speeding up model training and reducing model freedom.
is is a challenging problem because (1) the generation of adversarial network is a process of continuous game between the generator and discriminator during training.While constantly improving the generation of images, it is difficult for the model to reach equilibrium or even stability due to the violent fluctuation of gradient, and the training speed will be too slow.Traditional GAN training on the CPU takes about 3 hours.(2) e generation of adversarial network requires no modeling in advance.Although the process of generating pictures is simplified, the model is too uncontrollable and the freedom of the model is too large.
To counter the problems above, we use the transfer learning method in the unsupervised deep model and combine with other variational autoencoders of the image generation model to reduce the resource consumption and time of training generative adversarial network.In addition, based on the particularity of the decoder input of the variational autoencoder, the freedom of the model is further limited by limiting the input data distribution of the generator, which provides an improved method for the future training of other unsupervised generator models.In recent years, based on the great potential of generating adversarial network, the method has been widely improved and applied by researchers.Some studies use GAN in semisupervised learning.Finally, some research studies combine GAN with specific applications and achieve good results.
We combine transfer learning and unsupervised learning to make up for the shortcomings of both sides and use standard normally distributed sampling as parameters to increase input of the model.e specific combination and control methods are as follows: (1) e decoder of the trained variational autoencoders is used as the network architecture and initial parameters to generative adversarial network generator.e generator is provided with a new starting point for learning and make the loss function fall down as quickly as possible.Experiments show that the method can reduce the training time by about half.(2) Take standard normally distributed sampling as the input data of the generator, and the problem of too much freedom of the model is improved by limiting the input data of the model.

Related Works
e idea of generative adversarial networks (GANs) is derived from game theory's Nash equilibrium [1].e model is shown in Figure 1.GAN can be seen as a collection of two networks: a generator G, which is responsible for fetching data close to real data, and D, a discriminator, determines whether the sample is a real sample or a false sample, t is sampled from the real data, and n is the data generated by the generator.Two networks are trained by gaming each other, and the loss function is ( GAN can be found from conferences and journals in recent years [2][3][4][5][6][7][8]and is already a hot topic in artificial intelligence [9][10][11].It has many papers related to GANs. e original GAN [1] requires no Markov chain or expanded approximate inference network during training.DCGAN uses CNN to replace the basic nerve structure in GAN and uses global pooling layer to reduce the computation.PROGAN starts to train and gradually generates clear images from blurred images [12].SAGAN uses the weighted sum of the elements of all positions as the response of that location by self-attention and better handles the dependencies between different regions [13]; LP-WGAN [14] replaces Lipschitz [15] to lp-norm to constrain weight search and effectively close the generated distribution and the true distribution.WGAN-GP [16] uses improved gradient penalty to solve the problem of associating parameters with limits to achieve real Lipschitz constraints.
e LSGAN changes the target function of the model, more accurately describes the loss of the model and solves the problems of low picture quality and unstable training process [17].
F-GAN proofs that any divergence is suitable for generating models [18].UGAN can remove the source category information retained in the generated image, making the source category of the generated image more difficult to track [19].LSGAN uses Lipschitz regular conditions to further normalize its loss function to the density of real data [20].MRGAN takes advantage of the unique geometry of real data, especially manifold information [21].Geometric GAN [22] uses SVM to separate hyperplanes to maximize margin.RGAN [23]considers that the probability that the real data is true should be reduced because this can reduce the gap between true and false data and make the data smoother.
e autoencoder designs a neural network architecture that imposes bottlenecks on the network and forces the original input to compress knowledge representation.e autoencoder is shown in Figure 2. e autoencoder forces the model to retain only the changes of data required by the reconstruction input, but not the redundancy of input.erefore, the loss function is referred to as

Methods
Transfer learning is to transfer the parameters of the model learned and trained to the new model to help the training of the new model.Most of the data or tasks are correlated.
rough transfer learning, the model parameters can be shared with the new model in some way to speed up and optimize the learning efficiency of the model without learning from zero as most networks do.Transfer learning mainly includes the concept of data domain and task.A data 2 Mathematical Problems in Engineering domain D consists of the feature space X and the probability distribution P(X), and X � x 1 ,x 2 ,...,x n .A task T consists of a label space Y and an objective function F. Different models can be transferred according to the correlation between the data domains and tasks of the source model and the target model in transfer learning.

Transfer Learning eory Based on CNN. Transfer learning based on convolutional neural network can be divided into two methods.
In the development model, we need to select a relevant predictive modeling problem with rich data first.ere is a relationship between the input data of the original task and the target task, the output data, and the concepts learned by adjusting the model parameters with the input data.en, we need to define an excellent network model for the original task to ensure that the network can enhance the representation of features of original dataset as much as possible.
en, the network model of the original task can be selected as the training starting point of the network model of the new task.Part or all of the original network model can be selected according to the needs of the new task.Finally, according to the training results of the new model and the needs of the target task, the network model can be adjusted appropriately to make it perform better in the new task.
In the pretraining model, we select the source model first.e pretraining model is difference from the development model because the basic model does not need to be trained.Many research institutions have already trained the basic model in the super-large dataset, and the caller only needs to select the network model suitable for the new task.en, we reuse the model, select the network model of the original task as the training starting point of the network model of the new task, and select part or all of the original network model according to the needs of the new task.Finally, according to the training results of the new model and the needs of the target task, the network model can be adjusted appropriately to make it perform better in the new task.Encoder Decoder e training times of the discriminator are k, which is a hyperparameter.e dataset is input into the encoder of the variational autocoder so that the encoder learns mean and variance.

Transfer Learning
e potential variable n is selected from the standard normal distribution and input into the decoder to train the variational autocoder so that its loss function is stable or even minimal.
e network structure and network parameters of the decoder of the variational autocoder after training are transferred to the generative adversarial network as its initial generator for the following training.e improved original generative adversarial network algorithm is described in Algorithm 1.

Experiments
In this experiment, the MNIST, CIFAR10, and LSUN datasets are used to compare different models.e MNIST is a computer vision dataset, which contains 70,000 grayscale images of handwritten digits, each of which contains 28 * 28 pixels, and each image has a corresponding label that is the corresponding number of images.e CIFAR10 has a total of 60,000 color images, and the image pixels are 32 * 32, which are divided into 10 categories with 6,000 images in each category.
e LSUN mainly includes 10 scene categories and 20 object categories, and each category has about one million pictures.It is a scene understanding image dataset, mainly including bedroom, house, living room, classroom, and other scene images.We improve the generative adversarial network, deep convolutional network, and WGAN-GP, respectively, in three datasets.e details are shown in Table 1.
e original generative adversarial network trains the MNIST dataset, and the improved original generative adversarial network adopts the same network structure.e leaky ReLU activation function is used in the original network activation function.Deep convolution generative adversarial network is to change the structure of the original generative adversarial network.e improved deep convolution generative adversarial network adopts the same network structure.In the discriminator of deep convolution generative adversarial network, step convolution is used to replace pooling layer for down sampling, and in the generator, transposed convolution is used to replace upsampling.Removing the full connection layer and replacing the full connection layer with global pooling, the improved WGAN-GP and WGAN-GP adopt the same network structure as deep convolution generative adversarial network, while the WGAN-GP improves the loss function of network to avoid the model collapse.

Improved Original Generative Adversarial Network.
In this experiment, the low-pixel MNIST dataset is used for training, and the network structure of the generator and discriminator is relatively simple.In order to make a comparison with the original generative adversarial Input: noise data n (1) , . . ., n (m)    from standard normal distribution p g(n) and t (1) , . . ., t (m)   from the generated distributed data p data(t) .
Output: e losses of generator and discriminator.
For generative adversarial network training times do For k times do Select m small batch samples from standard normal distribution p g (n) .Select m small batch samples from the generated distributed data p data(t) .
Optimize discriminator weights by stochastic gradient ascent algorithm: ))] end For Select m random samples from standard normal distribution p g(n) .Optimize generator weights by random gradient descent algorithm: )) end For ALGORITHM 1: Improved original generative adversarial network Algorithm.D and G are the two parts that make up the GANs.Really sampled data t and the noise data n.G(n) is the sample generated by G that is closest to real data.D(t) is the discriminator of really sampled data, and D(G(n)) is the discriminator of fake data from the generator.Mathematical Problems in Engineering convergence and the loss function of the generator and discriminator tends to be stable.And improved WGAN-GP in training reaches to 20 k, network convergence, generator, and the discriminant loss tends to be stable; therefore, when using WGAN-GP algorithm based on migration study in LSUN dataset for network training, improve the convergence speed, the other by the result of the generated image, and generated images are also better than the previous images, and images become more acute.

Conclusions
In all unsupervised generative models, the generation of adversarial network has the advantages of clearer and sharper image generation, and does not need to use Markov chain to sample the input dataset repeatedly, and the model is more concise than other unsupervised network models.However, the problems of long training time and too much freedom of the model have not been improved.So, we put forward the transfer method between unsupervised generation models.First, we transfer the decoder of the variational autocoder to the generator that generates the adversarial network and the convergence speed of the adversarial network is greatly accelerated.Second, our model restricts the generation of the input of the antagonistic network and uses the standard normal distribution, which further limits the freedom of the model and makes it more instructive and closer to the real picture.Experiments show that generated    Mathematical Problems in Engineering pictures are more instructive and closer to the real pictures.e image resolution is still the focus of research, so we will design experiment to building a new network that makes the generated images more realistic and speeds up training in our future work.

Figure 10 :Figure 11 :Figure 12 :Figure 13 :Figure 14 :
Figure 10: (a) e discriminator loss function of improved deep convolutional generative adversarial networks.(b) e generator loss function of improved deep convolutional generative adversarial networks.

10
Based on Unsupervised Generation Model.Transfer learning is generally applied to the supervised discriminant model.e source model is

Table 1 :
e experimental comparison table.