Generative Adversarial Networks

Mlscvitpune
5 min readNov 12, 2022

--

Generative Adversarial Networks

“ Machine Intelligence is the last invention that humanity will ever need to make”

Nowadays, we can see that most of the people are getting more enthusiastic towards Artificial Intelligence and Machine Learning. Machine Learning is the foundation for the majority of current approaches to developing Artificial Intelligence. Previously, people were using supervised learning (which is classification) as a successful form of Machine Learning. But now we can see that Unsupervised Learning has drastically changed the field of Machine Learning. So, we describe one approach to Unsupervised Learning via generative modeling called GANs.

Artificial Intelligence

What is GAN ?

First of all, GAN stands for Generative Adversarial Networks. It is an unsupervised machine learning model in which there are two neural networks who compete with each other to make their respective predictions more accurate.

Generative Adversarial Networks

Now you will get a question: what are these two neural networks?

These two neural networks are Generator Network and Discriminator Network. They just compete with each other with competing objectives that work through opposing goals. This results in both of the networks coming up with gradually increasing complex ways to fool each other.

To understand these networks better, let’s take an example. Consider there is a city in which ‘money counterfeiting’ is carried out. So now we can imagine two agents: a COP and a CRIMINAL. Let’s take a look at their objectives:

  • Criminal’s Objective : The criminal’s main goal is to construct complex methods of counterfeiting money so that the Cop cannot tell the difference between counterfeited money and real money.
  • Cop’s Objective : The cop’s main goal is to construct complex methods for distinguishing between counterfeit and real money.
Illustration of Generator G(x) and Discriminator D(x)

So, This is the fundamental idea behind an Adversarial Process.

Adversarial Procedure is nothing but what we can observe in the Judiciary Court. Adversarial Processes are used to train two Neural Networks that compete with each other until a desirable equilibrium is reached in Generative Adversarial Networks.

“People worry that computers will get too smart and take over the world, but the real problem is that they’re too stupid and they’ve already taken over the world.”

Work of Generator and Discriminator

Here the Criminal works as a Generator Network G(z) which takes random noise as input and tries to generate data that is very close to the dataset we have been given.

On the other hand, the Cop works as a Discriminator Network D(x) which uses generated data as input and makes an effort to distinguish between generated data and actual data. The Discriminator Network implements a binary classification and gives the output the probability that the input data given to the model actually came from the real dataset.

Following is the objective function of this whole process:

Objective Function

For the above-described GANs, the Generator should typically model the real data, and the Discriminator should typically output the probability of 0.5 because the generated data is identical to the real data. That means, it is uncertain with equal probability whether the fresh data coming from the generator is real or fake.

You might be questioning why a learning process this complicated is even necessary. What benefits may one expect from learning such a model? The reasoning behind this and all generative methods is based on a well-known quotation from Richard Feynman:

“What I cannot create, I do not understand.”

This is significant because if we can generate real data distributions from a model, we know everything there is to know about that model. A model with thousands of parameters can be used to build these real distributions, which often contain millions of photos and capture the essence of the input images.

This is significant because if we can generate real data distributions from a model, we know everything there is to know about that model. A model with thousands of parameters can be used to build these real distributions, which often contain millions of photos and capture the essence of the input images.

Generative Adversarial Networks Working Diagram

Why GANs ?

Now many of us will wonder why we use this Generative Adversarial Networks since we also have other algorithms that can do the same work as GANs.

Let’s take a real life example here. We all use Google Maps or any other app for navigating through unknown places. Have you ever thought about how many images of that location should be given as input to that particular app?

Mapping routes of the areas

Yesss! They require millions of satellite images of the location to map its routes correctly. So, to train this millions of data requires large servers and computational powers. Here comes the role of GANs. It can generate more and more fake images from a dataset and from just thousands of images, we can end up with a million images.

“Predicting the future isn’t magic, it’s artificial intelligence.”

So, In terms of producing realistic data, especially images, GANs have achieved considerable practical success. Right now, training them is challenging. For GANs to become a more reliable technology, it will be necessary to design models, costs, or training algorithms for which it is possible to find good Nash equilibria consistently and quickly.

Thanks for reading this blog until the end, I’m really glad to find people who’re as motivated as I am about science (specifically CS and AI).

Author: Amaan Khatib

--

--