A tensorflow implementation of "Deep Convolutional Generative Adversarial Networks"
JavaScript Python HTML CSS
Latest commit 15ef89f Jan 18, 2017 @carpedm20 committed on GitHub Merge pull request #86 from macaodha/patch-1
Solves indexing error in Python 2.7

README.md

DCGAN in Tensorflow

Tensorflow implementation of Deep Convolutional Generative Adversarial Networks which is a stabilize Generative Adversarial Networks. The referenced torch code can be found here.

alt tag

  • Brandon Amos wrote an excellent blog post and image completion code based on this repo.
  • To avoid the fast convergence of D (discriminator) network, G (generator) network is updated twice for each D network update, which differs from original paper.

Online Demo

link

Prerequisites

Usage

First, download dataset with:

$ python download.py mnist
$ python download.py celebA

To train a model with downloaded dataset:

$ python main.py --dataset mnist --input_height=28 --output_height=28 --c_dim=1 --is_train
$ python main.py --dataset celebA --input_height=108 --is_train --is_crop True

To test with an existing model:

$ python main.py --dataset mnist --input_height=28 --output_height=28 --c_dim=1
$ python main.py --dataset celebA --input_height=108 --is_crop True

Or, you can use your own dataset (without central crop) by:

$ mkdir data/DATASET_NAME
... add images to data/DATASET_NAME ...
$ python main.py --dataset DATASET_NAME --is_train
$ python main.py --dataset DATASET_NAME
$ # example
$ python main.py --dataset=eyes --input_fname_pattern="*_cropped.png" --c_dim=1 --is_train

Results

result

celebA

After 6th epoch:

result3

After 10th epoch:

result4

Asian face dataset

custom_result1

custom_result1

custom_result2

MNIST

MNIST codes are written by @PhoenixDai.

mnist_result1

mnist_result2

mnist_result3

More results can be found here and here.

Training details

Details of the loss of Discriminator and Generator (with custom dataset not celebA).

d_loss

g_loss

Details of the histogram of true and fake result of discriminator (with custom dataset not celebA).

d_hist

d__hist

Author

Taehoon Kim / @carpedm20