Member-only story
Image Generator - Drawing Cartoons with Generative Adversarial Networks
Generating Simpsons with DCGANs

In today’s article, we are going to implement a machine learning model that can generate an infinite number of alike image samples based on a given dataset. In order to do so, we are going to demystify Generative Adversarial Networks (GANs) and feed it with a dataset containing characters from ‘The Simspons’. By the end of this article, you will be familiar with the basics behind the GANs and you will be able to build a generative model on your own!
To get a better idea about the GANs’ capabilities, take a look at the following example of the Homer Simpson evolution during the training process.
Fascinating, right?
Let’s dive into some theory to get a better understanding of how it actually works.
Generative Adversarial Networks (GANs)
Let’s start our GAN journey with defining a problem that we are going to solve.
We would like to provide a set of images as an input, and generate samples based on them as an output.
Input Images -> GAN -> Output Samples
With the following problem definition, GANs fall into the Unsupervised Learning bucket because we are not going to feed the model with any expert knowledge (like for example labels in the classification task).
The idea of generating samples based on a given dataset without any human supervision sounds very promising.
Let’s find out how it is possible with GANs!
The underlying idea behind GAN is that it contains two neural networks that compete against each other in a zero-sum game framework, i.e. generator and a discriminator.
Generator
The Generator takes random noise as an input and generates samples as an output. It’s goal is to generate such samples that will fool the Discriminator to think that it is seeing real images while actually seeing fakes. We can think of the Generator as a counterfeit.