All about Generative Adversarial Networks (GANs)

Mohamed Bakrey Mahmoud
6 min readAug 12, 2022

--

Introduction

In this article, we will discuss one of the most important algorithms and networks in which deep learning works. We will learn about what GANs are, as it is one of the important models. Here, too, we can mention the entry of deep learning into many applications in industries. Neural networks are widely used in almost every business sector, such as healthcare, finance, and e-commerce. These neural networks help solve business problems.

What are generative adversarial networks(GANs)?

Generative Adversarial Networks (GANs) were introduced in 2014 by Ian J. Goodfellow and co-authors. GANs perform unsupervised learning tasks in machine learning and deep learning. It consists of two models that automatically detect and learn patterns in the input data. Here the two models are known as Generator and Discriminator. They are constantly in competition with each other to examine, capture, and iterate changes within a data set. GANs can be used to generate new examples that can be extracted from the original data set.

What is the generator in the network used?

A generator in GANs is a neural network that generates fake data to be trained on a discriminator. Learn how to generate reasonable data. The generated examples become passive training examples for the discriminator. It takes a fixed-length random vector that carries noise as input and generates a sample for a given reason.

The intended purpose of the generator is to make the discriminator classify its outputs as real and constant. Here the part of the GAN that trains the generator includes:

  • Noisy input vectors
  • Generator network, which converts random input into a data instance
  • Discrimination network, which classifies the generated data
  • Loss of the alternator, which penalizes the alternator for failing to remove the discriminator

The back-propagation method is used to set each weight in the correct direction by calculating the effect of the weight on the output. It is also used to get gradients and these gradients can help change generator weights.

We can look at, What is the Discriminator?

The Discriminator is one of the neural networks that identify the real data from the fake data generated by the generator. Discriminator training data comes from two different sources: Real data examples, such as real pictures of birds, humans, currency notes, etc., are used by the discrimination as positive samples during the training process. The instances of fake data generated by the generator are used as negative examples during the training process in which they are used.

And here when we work while training the discriminator that we worked on, it relates to two loss functions. Where during discriminator training, the discriminator ignores the generator loss and uses only the discriminator loss. In the discriminator training process, the discriminator classifies both the real data and the fake data from the constructor. Discriminant loss is penalized for misclassifying a real data instance as a spurious or spurious data instance as a real instance.The discriminator updates its component weights through backpropagation from the discriminator loss through the discriminator network.

Here we can go to how that network works and how it can work with it:

If we see the GAN, we will see that it consists of two neural networks. There is a generator G (x) and a characteristic D (x). They are both playing a game of opposite each other. We can say that they are antagonistic to each other. Here the generator’s goal is to trick the discriminator by producing data that is actually similar to that in the training set it is working on. The discriminator will try not to be fooled by identifying fake data from the real data. Both work simultaneously to learn and train complex data such as audio, video or image files. The generator network takes a sample and creates a fake sample of the data. The generator is trained to increase the probability of making certain mistakes.

What steps are used to train the GANs network?

  • Define the problem
  • Choose the architecture of GAN
  • Train discriminator on real data
  • Generate fake inputs for the generator
  • Train discriminator on fake data
  • Train generator with the output of the discriminator

What are the types of networks that branch from the GAN?

Vanilla GANs: Vanilla GANs have a minimal optimization syntax where the Discriminator is binary sorted and uses the loss of sigmoid entropy during optimization. The generator and differentiator in vanilla GANs are multi-layered perceptions. The algorithm attempts to improve the mathematical equation by using random gradient descent.

Deep Convolutional GANs (DCGANs): DCGANs support convolutional neural networks instead of vanilla neural networks in both the Discriminator and Generator. It is more stable and produces better quality images. The generator is a set of segmented convolution layers or switched convolutions, so it samples the input image in each convolutional layer. The discriminator is a set of convolution layers with gradient convolutions, so it subtracts the input image samples into each convolution layer.

Conditional GANs: Vanilla GANs can be extended into conditional models using additional naming information to achieve better results. In CGAN, an additional parameter “y” is added to the generator to generate the corresponding data. Labels are fed as input to the discriminator to help distinguish real data from fake generated data.

Ultra-high-resolution GANs: SRGANs use deep neural networks in combination with an adversarial network to produce higher-resolution images. SRGANs generate a realistic high-resolution image when given a low-resolution image.

Advantages of Generative Adversarial Networks (GAN’s)

  • This network has many advantages as it generates data that is similar to the original data. And if you give the GAN an image, a new copy of the image will be created that looks exactly like the original. Likewise, it can create different versions of text, video and audio.
  • GANs get into the details of the data and can easily be translated into different versions, so they are useful for doing machine learning work.
  • Using GANs and machine learning we can easily get the identifier of many things like the things we encounter on the streets and that we encounter in our daily life.

Disadvantages of Generative Adversarial Networks (GANs)

  • It is considered one of the most difficult networks in the training process as it needs to constantly provide different types of data to check whether it is working accurately or not.
  • In this network, it is very complicated to generate results from text or speech

Conclusion.

In this article, we worked on one of the most famous networks belonging to the neural network family and deep learning, where we defined it and worked to clarify most of its parts from several sides until we came to work on mentioning its advantages and disadvantages, and we found that its advantages are very many and we preferred to mention the most influential of them. It is a large network in a large part in machine learning, as it works on the data from which learning algorithms learn to Fa. In another part, I will touch on working on the part of the code when I work on a project for it. I hope that this article will be useful to you. Enjoy reading it.

Mohamed B Mahmoud. Data Scientist.

Originally published at https://mohamedbakrey094.medium.com on August 12, 2022.

--

--

Mohamed Bakrey Mahmoud
Mohamed Bakrey Mahmoud

No responses yet