Skip to content

Example implementation of DCGAN on CelebA dataset in PyTorch

Notifications You must be signed in to change notification settings

jpowie01/DCGAN_CelebA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DCGAN for CelebA in PyTorch

This repository contains an example implementation of a DCGAN architecture written in PyTroch.

For the demonstration, I've used CelebA dataset.

How to run it?

Training and visualization should work without any modifications and default arguments will reproduce my results. Hyperparameters were taken from the papers but can be tuned by passing arguments to below scripts.

Download dataset:

  1. Use this Google Drive to download images (URL points to original dataset shared by its authors).

  2. Put it into dataset directory and unpack.

  3. Wrap unpacked directory (img_align_celeba) into another one named celeba. This is a requirement set by PyTorch's implementation of ImageFolder.

Instruction:

$ virtualenv -p python3.7 venv
$ . venv/bin/activate
(venv) $ pip install -r requirements.txt
(venv) $ python train.py
(venv) $ python visualize.py --checkpoint={YOUR_CHECKPOINT}

Help:

(venv) $ python train.py -h
(venv) $ python visualize.py -h

Training

It takes about 50 epochs to train DCGAN that fools discriminator on ~90% of fake images. Feel free to run it for longer time! A single epoch takes about ~8:45 minutes on the GTX 1060 6GB.

Results

Visualization of example images

Figure

Visualization of latent space

Example 1 Example 2 Example 3 Example 4
Animation Animation Animation Animation

DCGAN Architecture

Architecture

Resources

  • [arXiv] Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, Yoshua Bengio "Generative Adversarial Networks"

  • [arXiv] Alec Radford, Luke Metz, Soumith Chintala "Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks"

About

Example implementation of DCGAN on CelebA dataset in PyTorch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages