Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Generator 
3.
Discriminator 
4.
Types of GANs
4.1.
Vanilla GANs 
4.2.
Deep Convolutional GANs
4.3.
Conditional GANs
4.4.
Super Resolution GANs
5.
Applications of GANs
6.
Frequently Asked Questions
7.
Key Takeaways
Last Updated: Mar 27, 2024

Generative Adversarial Network

Author Rajkeshav
0 upvote
Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

Introduction

GAN is an unsupervised learning task in machine learning. It consists of two models that automatically discover and learn the patterns in the input data. The two models called Generator and Discriminator compete in analysing, capturing, and copying the variations within the data set. GANs can generate new examples from the original data set. 

 

Source

 

We can see a database with actual Hundred rupee notes in the image. The generator, a neural network, generates fake Hundred rupee notes. The discriminator network will identify if notes are real or fake.

Also See, Resnet 50 Architecture

Generator 

 

Source

 

The Generator in Generative Adversarial Network is a neural network. The generator creates fake data which trains on the discriminator. Generator Learns to generate plausible data. The generated instances are treated as negative training examples for the discriminator. It takes a fixed-length vector carrying noise as input and produces a sample. The aim of the generator is to make the discriminator classify its output as accurate. The Generative adversarial network that trains a generator includes 

  • A noisy input vector,  
  • The generator network that transforms the random input into a data instance,  
  • A discriminator network that classifies the generator data.


The generator loss penalizes the generator for the incorrect result.

The backpropagation is used to adjust each weight in the right direction by calculating the weight's impact on the output. The backpropagation method is used to obtain gradients, which can help change the generator weight. 

 

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Discriminator 

 

Source

 

A Discriminator is a neural network model that identifies actual data from the fake data generated by the generator. The discriminators' training data comes from two sources. 

The discriminator uses the actual data instances such as real pictures of birds, human currency notes, etc. as positive samples during the training.

The fake data instances created by generators are treated as a negative example. While training the discriminator, it connects with two loss functions. The discriminator ignores the generator loss during discriminator training and uses the discriminator loss. In preparing the discriminator, the discriminator classifies both actual and fake data from the generator. 

 

Source

 

GAN consists of two networks, a generator represented as G(x) and the discriminator defined as D(x). The function of the generator is to fool the discriminator by generating data similar to the training set. The discriminator tries to identify fake data from the actual data. They both work simultaneously to learn and train complex data like audio-video or image files. 

 

Types of GANs

Vanilla GANs 

Vanilla GANs has a min-max optimization formula where the discriminator is a binary classifier and uses sigmoid cross-entropy loss during optimization. In Vanilla General Adversarial Networks, the generator and the discriminator are multilayer perceptrons. The GAN algorithm tries to optimize the mathematical equation using gradient descent.

Deep Convolutional GANs

The Deep convolutional GANs support neural networks instead of vanilla neural networks at discriminators and generators. They are most stable and generate higher-quality images. The generator is a state of convolutional layers with fractionally strided convolutions for transport convolutions. It samples the input image at every convolutional layer.

Conditional GANs

In conditional GANs, an additional parameter is added to the generator for generating the corresponding data.

Discriminators are fed with Labels that help to distinguish the actual data from fake data generated.

Super Resolution GANs

SR GANs use deep neural networks and adversarial neural networks to produce higher resolution images. Super-resolution games generate a photorealistic high-resolution image when given a low-resolution picture.

Applications of GANs

  • With the help of GANs, we can train images of cartoon characters to generate faces of anime characters.
  • GANs can be used on the faces of humans to generate realistic faces. These two faces do not exist in reality. 
  • GANs can build realistic images from a textual description of an object like birds, humans, and other animals.
  • GANs can generate 3D models using 2D pictures of objects from multiple perspectives. 

 

Frequently Asked Questions

  1. What is a Generative Adversarial Network?
    GAN is an unsupervised learning task in machine learning. It consists of two models that automatically Discover and learn the patterns in the input data. The two models, called generator and discriminator, compete in analysing, capturing, and copying the variations within the data set.
     
  2. What is a discriminator in a Generative Adversarial Network?
    A discriminator is a neural network model that identifies accurate data from the fake data generated by the generator. 
     
  3. Name the different types of Generative Adversarial Networks?
    1. Vennila GANs
    2. Deep Convolutional GANs
    3. Conditional  GANs
    4. Super-resolution GANs
     
  4. Who discovered Generative Adversarial Networks?
    Ian Goodfellow found the Generative Adversarial Network.
     
  5. How is backpropagation used in Generative Adversarial Networks?
    The backpropagation is used to adjust each weight by calculating the weight's impact on the output.

Key Takeaways

The Generative Adversarial Network is a powerful Artificial Intelligence tool with many real-world applications. To learn more about such exciting machine learning techniques, you must visit the link.

Next article
Building GAN - Implementation
Live masterclass