Skip to content

We will train a GAN to generate images of anime character's faces, human faces, art, and handwritten digits. We will build four generative models on MNIST, Best Artworks of All Time, CelebA, and Anime Face datasets.

Notifications You must be signed in to change notification settings

srinivaskool/4-GANs-Implementations

Repository files navigation

4-GANs-Implementations

We will train a GAN to generate images of anime characters faces, human faces, art and hand written digits. So we build 4 generative models on MNIST, Best Artworks of All Time, CelebA and Anime Face datasets.


Table of Contents


Description


Deep neural networks are used mainly for supervised learning: classification or regression. Generative Adversarial Networks or GANs, however, use neural networks for a very different purpose: Generative modeling 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. I have used opendatasets for downloading data and in a model, I have used CenterCrop, Normalization, LeakyReLU, BatchNorm, ConvTranspose2d, Binary Cross Entropy. Inside every folder, there is a real dataset and our images and the training video for each implementation.

Built With

  • PyTorch
  • Matplotlib

For Execution

The easiest way to start executing the code is to click the Run button at the top of this page and select Run on Colab. Google Colab is a free online platform for running Jupyter notebooks using Google's cloud infrastructure. You can also select "Run on Binder" or "Run on Kaggle" if you face issues running the notebook on Google Colab.

To run the code on your computer locally, you'll need to set up Python, download the notebook and install the required libraries. We recommend using the Conda distribution of Python. Click the Run button at the top of this page, select the Run Locally option, and follow the instructions.


Datasets and Project Colab Links


Human Faces Generation

This dataset is great for training and testing models for face detection, particularly for recognising facial attributes such as finding people with brown hair, are smiling, or wearing glasses.

Open In Colab

Anime Faces Generation

This dataset is often used for varying projects with anime faces. I will keep this dataset up-to-date and clean, along with including fun scripts for generating anime waifus!

Open In Colab

Art Generation

This dataset is collection of artworks of the 50 most influential artists of all time.

Open In Colab

Hand Written Digits Generation

Dataset - MNIST

This dataset is collection of 60,000 small square 28×28 pixel grayscale images of handwritten single digits between 0 and 9.

Open In Colab


Results


Anime Faces Generation

Final Image

Human Faces Generation

Final Image

Art Generation

Final Image

Hand Written Digits Generation

Final Image


Project Layout

4-GANs-Implementations
├─ Anime Faces Generation - animefacedataset
│  ├─ DCGAN_Anime_Faces.ipynb
│  ├─ model
│  │  ├─ D.pth
│  │  └─ G.pth
│  ├─ Real Vs Fake Scores.png
│  ├─ Real.png
│  ├─ Result.png
│  ├─ Training Video.avi
│  └─ video_to_gif.gif
├─ Architecture.webp
├─ ART Generation - best-artworks-of-all-time Dataset
│  ├─ GAN_ART.ipynb
│  ├─ Loss vs Epoch.png
│  ├─ model
│  │  ├─ D.pth
│  │  └─ G.pth
│  ├─ Real vs Fake Scores.png
│  ├─ Real.png
│  ├─ Result.png
│  ├─ Training Video.avi
│  └─ video_to_gif.gif
├─ Hand Written Digits Generation - MNIST Dataset
│  ├─ Loss vs epoch.png
│  ├─ MNIST GAN.ipynb
│  ├─ model
│  │  ├─ D.ckpt
│  │  └─ G.ckpt
│  ├─ Real vs Fake Scores.png
│  ├─ real.png
│  ├─ Result.png
│  ├─ Training Video.avi
│  └─ video_to_gif.gif
├─ Human Faces Generation - celeba Dataset
│  ├─ Human_Faces_DCGAN.ipynb
│  ├─ Loss vs epoch.png
│  ├─ model
│  │  ├─ D.pth
│  │  └─ G.pth
│  ├─ Real vs Fake Score.png
│  ├─ real.png
│  ├─ Result.png
│  ├─ Training Video.avi
│  └─ video_to_gif.gif
└─ README.md


References


Author Info

About

We will train a GAN to generate images of anime character's faces, human faces, art, and handwritten digits. We will build four generative models on MNIST, Best Artworks of All Time, CelebA, and Anime Face datasets.

Topics

Resources

Stars

Watchers

Forks