This repository contains an example implementation of a DCGAN architecture written in PyTroch.
For the demonstration, I've used CelebA dataset.
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:
-
Use this Google Drive to download images (URL points to original dataset shared by its authors).
-
Put it into
dataset
directory and unpack. -
Wrap unpacked directory (
img_align_celeba
) into another one namedceleba
. 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
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.
Visualization of example images
Visualization of latent space
Example 1 | Example 2 | Example 3 | Example 4 |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
-
[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"