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

FakeFaceGAN

In this project, I am trying to Generate fake human faces from original human faces using General Adversial Networks (GANs) in Pytorch. Which has been taught us by our instructor of this course Aakash N S . Who made this course very easy to understand by explaining each and every line of codes and concepts in both languages Hindi and English. he created interest in me towards artficial intlelligence and machine learning. Looking farword to learn more about AI and ML by his upcoming courses.

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 = 'GANS-project'

Dataset

I am using the utk-face-cropped dataset from kaggle, which consists of over 24,000 human faces. Note that generative modeling is an unsupervised learning task, so the images do not have any labels.

Downloading and Exploring the Data

Using the opendatasets library to download the dataset from Kaggle. opendatasets uses the Kaggle Official API for downloading datasets from Kaggle.