Intuition behind GANs — Generative Adversarial Networks (Beginner Friendly)
GANs or Generative Adversarial Networks are a type of machine learning framework. It has two neural networks which compete against each other in a game. One is a generator, and the other is a discriminator. In this article, we will see how they work.
How do GANs work?
GANs are made of two neural networks, i.e. a generator and a discriminator. To make it simple, let’s think of the generator as a counterfeit currency maker and the discriminator as an inspector. The role of the counterfeit currency maker is to generate a realistic currency note, and that of the inspector is to flag the fake currency notes from the real ones. Here the inspector is not all that bad though; he also helps the counterfeit currency maker in improving his results by giving him feedback.
At first, the generator knows nothing and the discriminator is an untrained classifier model which classifies the images given to it as real or fake.
The generator’s task is to fool the discriminator. To do that, it tries its best and produces a random image from some input noise which is then fed into the discriminator with a bunch of real currency note images.
The discriminator is seeing these images for the first time, so it doesn’t know what is what. So, to teach it, we will give it the answers for the first batch so that it can learn from it.
Then the same process is repeated, but this time, instead of the discriminator, the generator will use the discriminator’s output as feedback to tune itself.
These two steps are alternately performed till the generator starts producing realistic currency notes and is able to fool the discriminator.
While training these two models, we have to be very careful. We don’t want to make either of them too good at their job because if that happens, it will hinder the other model’s progress and you will not get a good result. To avoid that, we have to make sure that they both are equally good at their jobs throughout the training process.
Uses of GANs
- Art: GANs can be used to generate art.
• NVIDIA GauGAN: You can draw a rough sketch of a landscape, and the GAN will produce a photo-realistic image of that sketch.
• Art Breeder: You can mix two images and create funky looking images.
• DeepArt.io: You can add different art styles to your photos. - Science:
• GANs can be used to create more data for models for which data is scarce or hard to collect.
• They can also be used to improve astronomical images, images with noise, etc. - Video Games:
• GANs are used to upscale textures from a very low resolution to up to 4K. - Other:
• ThisPersonDoesNotExist: The faces on this site are all artificially generated using GANs.
Basic Projects for Beginners
- Generating handwritten numbers using GANs
2. Generating images of different fashion items
Other Resources
- Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative Adversarial Networks. In NIPS, 2014.
- Tero Karras, Timo Aila, Samuli Laine and Jaakko Lehtinen (NVIDIA). Progressive Growing of GANs for Improved Quality, Stability, and Variation. In ICLR, 2018.
About Me
Hello fellow enthusiast! I am Yajat Malhotra. I am a fresher pursuing a bachelor’s degree in Computer Science and Engineering. This is my first article. I hope you enjoyed reading it and that you learnt something new from it.
You can find me on various platforms: LinkedIn, Twitter, Kaggle and GitHub
If you have any questions, feel free to ask.
If you have any feedback, do share it with me.