GENERATIVE ADVERSARIAL NETWORKs (GANs)

Generative Adversarial Networks (GANs), GANs are deep learning generative algorithms that generate new data instances that resemble the training data. GAN is made up of two parts: a generator that learns to generate false data and a discriminator that learns from that false information. The use of GANs has increased over time. They can be used to improve astronomical images as well as to simulate gravitational lensing for dark matter research. GANs are used by video game developers to upscale low-resolution, 2D textures in old games by recreating them in 4K or higher resolutions via image training. GANs aid in the creation of realistic images and cartoon characters, as well as photographs of human faces and the rendering of 3D objects.

GANs work by the following three steps: First, the discriminator learns to differentiate between the generator's bogus data and the genuine sample data. Second, during the initial training, the generator generates fake information, and the discriminator quickly learns to recognize it. Third, to update the model, the GAN sends the results to the generator and discriminator.

Below is a diagram of how GANs operate:

As we’ve discussed that GANs consists of two ANN or CNN models: Generator Model: Used to generate new images which look like real images. Discriminator Model: Used to classify images as real or fake. Let us understand each separately. Note: For simplicity, we’ll consider the Image Generation application to understand the GANs. Similar concepts can be applied to other applications. 1. The Generator Model The Generator Model generates new images by taking a fixed size random noise as an input. Generated images are then fed to the Discriminator Model. The main goal of the Generator is to fool the Discriminator by generating images that look like real images and thus makes it harder for the Discriminator to classify images as real or fake. 2. The Discriminator Model The Discriminator Model takes an image as an input (generated and real) and classifies it as real or fake. Generated images come from the Generator and the real images come from the training data. The discriminator model is the simple binary classification model.

Full Implementing a Toy Data using Generative Adversarial Networks GANs in Python with Keras

Now we’ve got a clear idea about the GANs. Let’s start implementing it using Tensorflow and Keras. We can see the output seems like the figure below:

The generated images aren’t quite clear, right? Because we haven’t used Convolution layers in our model. Try Deep Convolutional GANs section to practice more.

See Full Code Implementing a Toy Data using Generative Adversarial Networks GANs in Python with Keras below,