Introduction to Generative Adversarial Networks
In this article, we are going to learn about the basics of famous deep learning algorithm GANS (Generative Adversarial Networks). These days GANs is a highly discussed and researched topic and probably you also heard about it or the applications powered by GANs, from DeepFakes to Nvidia’s DLSS (Deep Learning Super Sampling). We will learn how the algorithm behind GAN makes it unique and powerful.
What is a Generative Adversarial Network?
Generative Adversarial Network is a neural network-based algorithm and it is a type of generative model. Generative models used to generate/understand the higher dimensional data, whereas the Discriminative model tries to classify the data. For example, a discriminative algorithm tries to learn the function given the labeled data which will then maps the input to its output, for example, classification of handwritten digits, whereas a generative algorithm tries to learn the probability distribution given .
How GANS works?
A GAN consist of two subnetworks known as Generator and Discriminator. The role of the Generator is to generate the data let’s say and the discriminator checks whether the input data is generated (fake) or real. Let’s understand that more precisely, you can visualize the figure of GAN below:
As we can see that generator tries to generate the data and discriminator tries to identify whether the data is real or fake. The magic of GAN lies behind the training of these networks, they both compete againts each other, where generator is being trained to fool the discriminatoe so that it can’t differentiate between generated and real data, whereas discriminator is being trained such that the generator can’t fool it.
Loss Function for GAN
The loss function for GAN:
Both the networks try to optimize the loss function where generator tries to maximize it’s probability of getting it’s output recognized as real and discriminator try to minimize the function such that it can differentiate real and fake. Many articles refers this as a minmax game between these two subnetworks which is the reason why they are called adversarial networks.
Real-Life Applications of GANs
Let’s see some real-life applications where GANs were used as a primary tool in the main production pipeline:
- Nvidia’s DLSS technology
- Image Enhancement
Nvidia’s DLSS Technology: Almost all of you were familiar with Nvidia, known for its powerful GPUs. They have developed this GAN based DLSS (Deep Learning Super Sampling) technology which can generate a high quality upscaled version of an image up to 16K. The technology used in rendering low-quality 3D environments with Ray-Tracing and then upscale that rendered image to 2K, 4K, etc. You can see the results below:
Image Enhacement: There are many tools we use in our daily life for enhacing Images, and many of them are powered by GANs. One famous application is Deep Fakes, it uses GAN at it’s core for swaping the faces and enhacing the images. Below is the images which were enchanced by the tool using GAN.
The Images were referenced from a paper name “Deep Photo Enhancer”. You can check that paper here.