- This code adds multi GPU support to DCGAN code using Horovod framework. Horovod allows you to scale up to hundreds of GPUs and get a pretty decent scaling efficiency. If you are not familiar with horovod, check out this tutorial to learn more about it.
Installing Horovod
Check out
installation guide to learn
how to install it.
To run the example below with multiple GPUs follow this pattern; for example, to use 4 hosts with 1 gpu each do:
$ horovodrun -np 16 host-1:4,host-2:4,host-3:4,host-4:4 python main.py --dataset mnist --input_height=28 --output_height=28 --train
Tensorflow implementation of Deep Convolutional Generative Adversarial Networks which is a stabilize Generative Adversarial Networks. The referenced torch code can be found here.
- 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.
- Python 2.7 or Python 3.3+
- Tensorflow 0.12.1
- SciPy
- pillow
- (Optional) moviepy (for visualization)
- (Optional) Align&Cropped Images.zip : Large-scale CelebFaces Dataset
First, download dataset with:
$ python download.py mnist celebA
To train a model with downloaded dataset:
$ python main.py --dataset mnist --input_height=28 --output_height=28 --train
$ python main.py --dataset celebA --input_height=108 --train --crop
To test with an existing model:
$ python main.py --dataset mnist --input_height=28 --output_height=28
$ python main.py --dataset celebA --input_height=108 --crop
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 --train
$ python main.py --dataset DATASET_NAME
$ # example
$ python main.py --dataset=eyes --input_fname_pattern="*_cropped.png" --train
After 6th epoch:
After 10th epoch:
MNIST codes are written by @PhoenixDai.
More results can be found here and here.
Details of the loss of Discriminator and Generator (with custom dataset not celebA).
Details of the histogram of true and fake result of discriminator (with custom dataset not celebA).
Taehoon Kim / @carpedm20