Learn practical skills, build real-world projects, and advance your career

Generating New Celebrities

In the present project we will build a Generative Adversarial Network (GAN) to obtain new faces from images of celebrities faces. The new generated faces have to seem real, eventhough they don't belong to any real person.
Some questions will appear:

  • Do the "new celebrities" look real?
  • If so, might them resemble to a specific person?
  • Will the generated faces present more trend to a specific kind of feature (for instance, asian-like eyes or blond hair)?

Let's check it out!

First, we will import all the modules and libraries that we need.
Then, we will download the training data from the available Kaggle datasets (in folder 'celebrities-100k'). Then we have to buid a 'Discriminator' model and a 'Generator' model and train them.

!pip install jovian --upgrade --quiet
import os
import torch
import torchvision
import tarfile
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from torchvision.datasets.utils import download_url
from torchvision.datasets import ImageFolder
from torch.utils.data import DataLoader
import torchvision.transforms as tt
from torch.utils.data import random_split
from torchvision.utils import make_grid
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline

matplotlib.rcParams['figure.facecolor'] = '#ffffff'
project_name='new-celebrities'
!pip install opendatasets --upgrade --quiet