Generating Images Of Celebrities That Have Never Existed In Our World
Close your eyes, and think of a celebrity. Any celebrity. There's a 110% chance somebody popped up in your mind. Think about how easy it is to recall these people. Now, try thinking of someone you’ve never seen before, and create a completely new face in your head. It was pretty difficult, right?
Well, strangely enough, computers can do this! How can computers do this?
Computers that use General Adversarial Networks (GANs) are able to create realistic original images.

What Are GANs And How Do They?
GANs stands for General Adversarial Networks. GANs is essentially a framework for a deep learning model in order to capture the training data’s distribution and generate new data using the same distribution. What this means in simplified terms is using data to generate data.
The way GANs work is it has two distinctive models, a generator and a discriminator. The role of the generator is to generate ‘fake’ images that look as if they are part of the training data set, and the job of the discriminator is to distinguish between real images from the training data and the fake images generated by the generator.

The generator throughout the entire training process is getting better at creating these fake images, and the discriminator is getting better at distinguishing between the real images from the training data and the fake images generated by the generator. As you can see, from that we can tell that the more we train the model, the better the output data, the images, will be.
The model is done training when the generator is generating fake images so well that it leaves the discriminator guessing at a 50% confidence rate whether the image is from the training data and the fake images generated by the generator. So the generator has officially ‘won’ when the discriminator is guessing at a 50% confidence rate.
What Are DCGANs?
DCGANs stand for Deep Convolutional General Adversarial Networks. DCGANs are a type of GAN model and are one of the best models for generating images. The difference between a GAN and a DCGAN is that in a DCGAN, the generator and discriminator consist of convolutional layers in order to help the model run much more efficiently.
What Are Convolutional Layers?
Convolutional Layers is the way that the GAN is able to extract detailed features of the picture. Each neuron or node looks at different parts of the image and finds the details about the picture. This is much better than normal GAN model because, in a generic GAN model, each neuron looks at every pixel in the image, imagine how long that would take!
Now that we understand how convolution layers work you must be thinking, well the more layers we had would it not be better? Yes! You’re absolutely correct, the more layers you have the more complex features you will be able to find. Convolutional layers allow you to train your GAN much more efficiently, as the model will run faster and the output will be much more accurate.
What Did I Do With GANs?
Remember earlier in the article I told you about how GANs can create images of fake celebrities that don’t exist…well, that is exactly what I did! Using a DCGAN (a model of a GAN) I created realistic fake images of celebrities that don’t even exist in our world.
I used the Pytorch Deep Learning Framework to generate the images of these fake celebrities.
The Discriminator

If we look at the code we can notice a couple of things, the use of convolution layers, batch normalization layers, Leaky Relu function, and the sigmoid function, all of these layers and functions have a use. The convolutional layers help us with extracting the detailed features of the image and the batch normalization layers help us with running the model in a more efficient time frame. The Leaky Relu function helps us with identifying whether the image is real or fake, and the sigmoid function to outputs the probability between 0 and 1 depending on whether the image is real or fake. See all these lines of code are not that complicated after all!

The image starts from the left and goes through the convolutional layers. Once the image reaches the last layer, the network outputs if the image is a real image from the training data or a fake image generated by the generator.
The Generator

If you look at the code of the generator and discriminator, the generator is the opposite of the discriminator. The generator starts off with a vector of 100 random values between -1 and 1. Then the vector gets placed through several convolutional transposes layers to turn this vector into an image.
A convolutional transpose layer is the opposite of a convolution layer, in terms of the way it works and the structure of it. We understood the convolutional layer maps a group of values to one value, however convolutional transpose layers map one value to a group of values.

We know that the generator can produce fake images that are completely original because the vector is mapped to the statistical distribution of the dataset.
What Were The Results From My GAN?
Well, after countless errors in the program the GAN finally worked! The result was amazing! Remember the picture of celebrities that I put earlier in the article? Those were the images that my GAN created!

Takeaways
- GANs are General Adversarial Networks, a framework for a deep learning model in order to capture the training data distribution to generate new data using the same distribution
- DCGANs are Deep Convolutional General Adversarial Networks, which is a model of GANs that use convolutional and convolutional transpose layers in the generator and the discriminator
- I trained a GAN in order to generate realistic images of fake celebrities that don’t even exist in our world
By the way…
- This is just the first of many of my projects to come, you can stay up to date with all my articles, projects, and newsletters on my website, krishchandarana.com!
- Feel connect and follow me on LinkedIn, Twitter, and Medium!

