Awesome
News
- 28 June 2019: We re-implement these GANs by Pytorch 1.1! The old version is here: v0 or in the "v0" directory.
- Tensorflow 2 Version
<p align="center"> GANs - Pytorch </p>
Pytorch implementations of DCGAN, LSGAN, WGAN-GP(LP) and DRAGAN.
Exemplar results
Fashion-MNIST
DCGAN | LSGAN | WGAN-GP | DRAGAN |
---|---|---|---|
<img src="./pics/fashion-mnist_gan.jpg"> | <img src="./pics/fashion-mnist_lsgan.jpg"> | <img src="./pics/fashion-mnist_wgan-gp.jpg"> | <img src="./pics/fashion-mnist_dragan.jpg"> |
CelebA
DCGAN | LSGAN |
---|---|
<img src="./pics/celeba_gan.jpg"> | <img src="./pics/celeba_lsgan.jpg"> |
WGAN-GP | DRAGAN |
<img src="./pics/celeba_wgan-gp.jpg"> | <img src="./pics/celeba_dragan.jpg"> |
WGAN-LP | DRAGAN-LP |
<img src="./pics/celeba_wgan-lp.jpg"> | <img src="./pics/celeba_dragan-lp.jpg"> |
Anime
WGAN-GP | DRAGAN |
---|---|
<img src="./pics/anime_wgan-gp.jpg"> | <img src="./pics/anime_dragan.jpg"> |
Usage
-
Prerequisites
- PyTorch 1.1
- tensorboardX
- scikit-image, oyaml, tqdm
- Python 3.6
-
Datasets
- Fashion-MNIST will be automatically downloaded
- CelebA should be prepared by yourself in ./data/img_align_celeba/*.jpg
- dataset link: Dropbox
- the above link might be inaccessible, the alternatives are (find "img_align_celeba.zip")
- the Anime dataset should be prepared by yourself in ./data/faces/*.jpg
- dataset link: https://pan.baidu.com/s/1eSifHcA, password: g5qa
- reference: https://zhuanlan.zhihu.com/p/24767059
-
Examples of training
-
Fashion-MNIST DCGAN
CUDA_VISIBLE_DEVICES=0 python train.py --dataset=fashion_mnist --epoch=25 --adversarial_loss_mode=gan
-
CelebA DRAGAN
CUDA_VISIBLE_DEVICES=0 python train.py --dataset=celeba --epoch=25 --adversarial_loss_mode=gan --gradient_penalty_mode=1-gp --gradient_penalty_sample_mode=dragan
-
Anime WGAN-GP
CUDA_VISIBLE_DEVICES=0 python train.py --dataset=anime --epoch=200 --adversarial_loss_mode=wgan --gradient_penalty_mode=1-gp --gradient_penalty_sample_mode=line --n_d=5
-
see more training exampls in commands.sh
-
tensorboard for loss visualization
tensorboard --logdir ./output/fashion_mnist_gan/summaries --port 6006
-