Generating Faces with Deep Convolutional GANs

Dominic Monn
2 min readMay 15, 2017

--

As part of my Deep Learning Foundation Nanodegree at Udacity, I have learned how to generate new faces using Generative Adversarial Networks, or GANs for short.

If you have no idea what GANs are, maybe first read this handy article by Dev Nag where you learn about GANs in theory and also implement one in 50 lines of PyTorch code.

In the last few lectures of the Deep Learning Foundation Nanodegree program, students learn how to apply and implement GANs and in this project, the goal was to use that knowledge to implement a GAN to generate new faces. The idea was to implement a Deep Convolutional GAN and train the architecture on the MNIST dataset. As soon as the architecture was able to generate new handwritten digits, it was ready to generate new faces using the CelebA dataset.

DCGAN Architecture used in the project

When choosing the architecture of my DCGAN, I first settled for a simplified version of the Network described in the paper “Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks” which you can see above. Instead of using four convolutional layers, I only used two — and the results accordingly were blurry and inaccurate.

The blurry results of my simplified architecture

So I immediately got back to work and used the initial architecture described in the research paper with a total of four convolutional layers. The training time drastically increased, but the generated digits speak for themselves.

A generated handwritten digit

This obviously meant that my architecture was ready for training on the CelebA dataset. The training took approximately 15–20 minutes and even though the first few iterations looked like something demonic — the end result was fine.

Results after 5 iterations, in middle of training and at the end.

The results became recognizable as faces in the middle of the training process and refine themselves only a little bit until the end. This is the result after a single epoch. To make the faces less blurry, the training would need to go on a little bit longer.

If you want to check out my code, visit the project on my GitHub. All the code is on there! See you next time!

--

--