Original : [Tensorflow version]
Pytorch implementation of various GANs.
This repository was re-implemented with reference to tensorflow-generative-model-collections by Hwalsuk Lee
I tried to implement this repository as much as possible with tensorflow-generative-model-collections, But some models are a little different.
This repository is included code for CPU mode Pytorch, but i did not test. I tested only in GPU mode Pytorch.
Difference from tensorflow-generative-model-collections
- This repository does not have WGAN-GP and Variational Auto-Encoders.
- All models use only 25 training epochs.
- DRAGAN : The DRAGAN loss calculation method is different.
- ACGAN : The learning procedure is different.
- WGAN : The training of the discriminator is repeats 5 times in one iteration.
- EBGAN : The last layer of discriminator does not use sigmoid activation function.
- BEGAN : L1 norm is used instead of L2 norm.
Lists (Table is borrowed from tensorflow-generative-model-collections)
Name | Paer Link | Value Function |
---|---|---|
GAN | Arxiv | |
LSGAN | Arxiv | |
WGAN | Arxiv | |
DRAGAN | Arxiv | |
CGAN | Arxiv | |
infoGAN | Arxiv | |
ACGAN | Arxiv | |
EBGAN | Arxiv | |
BEGAN | Arxiv |
Variants of GAN structure (Figure is borrowed from tensorflow-generative-model-collections)
Network architecture of generator and discriminator is the exaclty sames as in infoGAN paper.
For fair comparison of core ideas in all gan variants, all implementations for network architecture are kept same except EBGAN and BEGAN. Small modification is made for EBGAN/BEGAN, since those adopt auto-encoder strucutre for discriminator. But I tried to keep the capacity of discirminator.
The following results can be reproduced with command:
python main.py --dataset mnist --gan_type <TYPE> --epoch 25 --batch_size 64
All results are generated from the fixed noise vector.
Name | Epoch 1 | Epoch 10 | Epoch 25 | GIF |
---|---|---|---|---|
GAN | ||||
LSGAN | ||||
WGAN | ||||
DRAGAN | ||||
EBGAN | ||||
BEGAN |
Each row has the same noise vector and each column has the same label condition.
Name | Epoch 1 | Epoch 10 | Epoch 25 | GIF |
---|---|---|---|---|
CGAN | ||||
ACGAN | ||||
infoGAN |
All results have the same noise vector and label condition, but have different continous vector.
Name | Epoch 1 | Epoch 10 | Epoch 25 | GIF |
---|---|---|---|---|
infoGAN |
Name | Loss |
---|---|
GAN | |
LSGAN | |
WGAN | |
DRAGAN | |
EBGAN | |
BEGAN | |
CGAN | |
ACGAN | |
infoGAN |
Comments on network architecture in mnist are also applied to here.
Fashion-mnist is a recently proposed dataset consisting of a training set of 60,000 examples and a test set of 10,000 examples. Each example is a 28x28 grayscale image, associated with a label from 10 classes. (T-shirt/top, Trouser, Pullover, Dress, Coat, Sandal, Shirt, Sneaker, Bag, Ankle boot)
The following results can be reproduced with command:
python main.py --dataset fashion-mnist --gan_type <TYPE> --epoch 25 --batch_size 64
All results are generated from the fixed noise vector.
Name | Epoch 1 | Epoch 10 | Epoch 25 | GIF |
---|---|---|---|---|
GAN | ||||
LSGAN | ||||
WGAN | ||||
DRAGAN | ||||
EBGAN | ||||
BEGAN |
Each row has the same noise vector and each column has the same label condition.
Name | Epoch 1 | Epoch 10 | Epoch 25 | GIF |
---|---|---|---|---|
CGAN | ||||
ACGAN | ||||
infoGAN |
Without hyper-parameter tuning from mnist-version, infoGAN does not work well as compared iwth CGAN/ACGAN.
ACGAN tends to fall into mode-collapse in tensorflow-generative-model-collections, but Pytorch ACGAN does not fall into mode-collapse.
infoGAN tends to ignore noise-vector. It results in that various style within the same class can not be represented.
All results have the same noise vector and label condition, but have different continous vector.
Name | Epoch 1 | Epoch 10 | Epoch 25 | GIF |
---|---|---|---|---|
infoGAN |
Name | Loss |
---|---|
GAN | |
LSGAN | |
WGAN | |
DRAGAN | |
EBGAN | |
BEGAN | |
CGAN | |
ACGAN | |
infoGAN |
The following shows basic folder structure.
├── main.py # gateway
├── data
│ ├── mnist # mnist data (not included in this repo)
│ | ├── t10k-images-idx3-ubyte.gz
│ | ├── t10k-labels-idx1-ubyte.gz
│ | ├── train-images-idx3-ubyte.gz
│ | └── train-labels-idx1-ubyte.gz
│ └── fashion-mnist # fashion-mnist data (not included in this repo)
│ ├── t10k-images-idx3-ubyte.gz
│ ├── t10k-labels-idx1-ubyte.gz
│ ├── train-images-idx3-ubyte.gz
│ └── train-labels-idx1-ubyte.gz
├── GAN.py # vainilla GAN
├── utils.py # utils
├── models # model files to be saved here
└── results # generation results to be saved here
- Ubuntu 14.04 LTS
- NVIDIA GTX 1080 ti
- cuda 8.0
- Python 2.7.6
- pytorch 0.2.0+5585c26
- numpy 1.13.1
- matplotlib 1.3.1
- imageio 2.2.0
- scipy 0.19.1
This implementation has been based on tensorflow-generative-model-collections and tested with Pytorch on Ubuntu 14.04 using GPU.