Learn practical skills, build real-world projects, and advance your career
!pip install jovian --upgrade --quiet

FakeFaceGAN

Generating fake human faces from original human faces using General Adversial Networks (GANs) in Pytorch.

General Adversial Networks (GANs)

Generative modeling is an unsupervised learning task in machine learning that involves automatically discovering and learning the regularities or patterns in input data in such a way that the model can be used to generate or output new examples that plausibly could have been drawn from the original dataset. - Source

While there are many approaches used for generative modeling, a Generative Adversarial Network takes the following approach:

alt

There are two neural networks: a Generator and a Discriminator. The generator generates a "fake" sample given a random vector/matrix, and the discriminator attempts to detect whether a given sample is "real" (picked from the training data) or "fake" (generated by the generator). Training happens in tandem: we train the discriminator for a few epochs, then train the generator for a few epochs, and repeat. This way both the generator and the discriminator get better at doing their jobs.

GANs however, can be notoriously difficult to train, and are extremely sensitive to hyperparameters, activation functions and regularization. In this project, we'll train a GAN to generate fake human faces from original human faces.

project_name = 'final-project'

Dataset

We'll use the ffhq-Face Dataset, which consists of over 70,000 human faces. Note that generative modeling is an unsupervised learning task, so the images do not have any labels.italicized text