Ever wondered how Mona Lisa would have looked in real life?
Or have you ever wanted to create new faces so well that most people can’t distinguish the faces it generates from real photos?
How would you feel if I would say that you can predict future frames of a video?
Each of these is possible with the power of GANs.
Let's understand what these are and how they work!
Generative Adversarial Network or GANs are deep generative models. These are a combination of two networks that are opposed against each other and are neural network architectures that are capable of generating new data.
So let us break down the word and understand them.
Generative means capable of production or reproduction,
Adversarial means two sides who oppose each other and
Network means a system of interconnected things.
GANs are actually two different networks joined together and are composed of two halves:
But before understanding what these two are, let us know what is Loss Function 🤔.
The loss function describes how far the results produced by our network are from the expected result: how far an estimated value is from its true value. Its objective isn't to make the model good but is to keep it from going wrong.
Loss Function gives us the direction of the optimal solution.
The generator is the neural network architecture that takes in some input and reshapes it to get a recognizable structure that is close to the target. The main aim of the generator is to make the output look as close as possible to the real data.
But to make this possible, the generator network needs to be trained heavily.
So this term is going to be 1 if we are successfully able to fool the Discriminator.
Hence, we will have a log(something close to zero).
So does the generator want to maximize or minimize the loss?
Generator wants to minimize this loss.
The discriminator is a regular neural network architecture that does the classification job to categorize real data from the fake samples generated by the Generator.
Discriminator's training data comes from two sources:
- Read data used for training.
- Fake data generated by the Generator.
Let's divide this equation into 2 terms:
We take the log of D(x(i)),
x(i) = real so we want our
Discriminator to output
So, if we look at
log(1), the output is going to be
log(1-D(G(z))) generator is going to take in some random noise and it's gonna output something close to real(close to reality) and the discriminator is going to output either
0 or 1 and from discriminator's point of view, we want the output to be
So does the Discriminator want to maximize or minimize the loss?
Discriminator wants to maximize this loss.
LHS of this expression means that we want to minimize w.r.t Generator and maximize w.r.t Discriminator for some value function V takes to input the Generator and the Discriminator(D, G).
In the end, after a lot of training process, the generator can make
indistinguishable things from real ones and the Discriminator is forced to Guess.
Both the generator and the discriminator start from scratch without any prior knowledge and are simultaneously trained together.
Generative models can generate new examples from the sample that are not only similar to the class but real.
GANs have seen major success in the past years. They have a wider range of applications. Usage of GANs is not limited to these. Here are a few use cases.
Super Resolution: GANs can be used to enhance the resolution of images and videos. Here is an example of video super-resolution done by tempoGAN.
Security: GANs can be used for malware detection and intrusion detection. GANs can be used in a variety of cybersecurity applications, including enhancing existing attacks beyond what a standard detection system can handle.
Audio Generation: GANs can be used to generate high-quality audio, instrumentals, and voice samples. MuseGAN and [WaveGAN] are two such GANS.
Healthcare: GANs can be utilized to detect tumors. By comparing photos with a library of datasets of healthy organs, the neural network can be used to identify cancers. By finding disparities between the patient's scans and photos and the dataset images, the network can discover abnormalities in the patient's scans and photographs. Using generative adversarial networks, malignant tumors can be detected faster and more accurately.
Please share your thoughts and comments if you found this post interesting and helpful. Follow the links below to get in touch with me: