https://github.com/znxlwm/pytorch-generative-model-collections
Collection of generative models in Pytorch version.
https://github.com/znxlwm/pytorch-generative-model-collections
acgan began cgan collection conditional-gan dragan ebgan fashion-mnist gan generative-adversarial-network infogan lsgan mnist package pytorch wgan wgan-gp
Last synced: 23 days ago
JSON representation
Collection of generative models in Pytorch version.
- Host: GitHub
- URL: https://github.com/znxlwm/pytorch-generative-model-collections
- Owner: znxlwm
- Created: 2017-08-31T03:58:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-12T11:55:29.000Z (about 5 years ago)
- Last Synced: 2025-04-15T03:54:47.862Z (23 days ago)
- Topics: acgan, began, cgan, collection, conditional-gan, dragan, ebgan, fashion-mnist, gan, generative-adversarial-network, infogan, lsgan, mnist, package, pytorch, wgan, wgan-gp
- Language: Python
- Size: 124 MB
- Stars: 2,626
- Watchers: 63
- Forks: 541
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-GAN-papers - 10
README
# pytorch-generative-model-collections
Original : [[Tensorflow version]](https://github.com/hwalsuklee/tensorflow-generative-model-collections)Pytorch implementation of various GANs.
This repository was re-implemented with reference to [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections) by [Hwalsuk Lee](https://github.com/hwalsuklee)
I tried to implement this repository as much as possible with [tensorflow-generative-model-collections](https://github.com/hwalsuklee/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.
## Dataset
- MNIST
- Fashion-MNIST
- CIFAR10
- SVHN
- STL10
- LSUN-bed
#### I only tested the code on MNIST and Fashion-MNIST.## Generative Adversarial Networks (GANs)
### Lists (Table is borrowed from [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections))*Name* | *Paper Link* | *Value Function*
:---: | :---: | :--- |
**GAN** | [Arxiv](https://arxiv.org/abs/1406.2661) |![]()
**LSGAN**| [Arxiv](https://arxiv.org/abs/1611.04076) |![]()
**WGAN**| [Arxiv](https://arxiv.org/abs/1701.07875) |![]()
**WGAN_GP**| [Arxiv](https://arxiv.org/abs/1704.00028) |![]()
**DRAGAN**| [Arxiv](https://arxiv.org/abs/1705.07215) |![]()
**CGAN**| [Arxiv](https://arxiv.org/abs/1411.1784) |![]()
**infoGAN**| [Arxiv](https://arxiv.org/abs/1606.03657) |![]()
**ACGAN**| [Arxiv](https://arxiv.org/abs/1610.09585) |![]()
**EBGAN**| [Arxiv](https://arxiv.org/abs/1609.03126) |![]()
**BEGAN**| [Arxiv](https://arxiv.org/abs/1703.10717) |![]()
#### Variants of GAN structure (Figures are borrowed from [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections))
### Results for mnist
Network architecture of generator and discriminator is the exaclty sames as in [infoGAN paper](https://arxiv.org/abs/1606.03657).
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 --epoch 50 --batch_size 64
```#### Fixed generation
All results are generated from the fixed noise vector.*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*
:---: | :---: | :---: | :---: | :---: |
GAN ||
|
|
![]()
LSGAN ||
|
|
![]()
WGAN ||
|
|
![]()
WGAN_GP ||
|
|
![]()
DRAGAN ||
|
|
![]()
EBGAN ||
|
|
![]()
BEGAN ||
|
|
#### Conditional generation
Each row has the same noise vector and each column has the same label condition.*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*
:---: | :---: | :---: | :---: | :---: |
CGAN ||
|
|
![]()
ACGAN ||
|
|
![]()
infoGAN ||
|
|
#### InfoGAN : Manipulating two continous codes
All results have the same noise vector and label condition, but have different continous vector.*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*
:---: | :---: | :---: | :---: | :---: |
infoGAN ||
|
|
#### Loss plot
*Name* | *Loss*
:---: | :---: |
GAN |![]()
LSGAN |![]()
WGAN |![]()
WGAN_GP |![]()
DRAGAN |![]()
EBGAN |![]()
BEGAN |![]()
CGAN |![]()
ACGAN |![]()
infoGAN |### Results for fashion-mnist
Comments on network architecture in mnist are also applied to here.
[Fashion-mnist](https://github.com/zalandoresearch/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 --epoch 50 --batch_size 64
```#### Fixed generation
All results are generated from the fixed noise vector.*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*
:---: | :---: | :---: | :---: | :---: |
GAN ||
|
|
![]()
LSGAN ||
|
|
![]()
WGAN ||
|
|
![]()
WGAN_GP ||
|
|
![]()
DRAGAN ||
|
|
![]()
EBGAN ||
|
|
![]()
BEGAN ||
|
|
#### Conditional generation
Each row has the same noise vector and each column has the same label condition.*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*
:---: | :---: | :---: | :---: | :---: |
CGAN ||
|
|
![]()
ACGAN ||
|
|
![]()
infoGAN ||
|
|
- ACGAN tends to fall into mode-collapse in [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections), but Pytorch ACGAN does not fall into mode-collapse.
#### InfoGAN : Manipulating two continous codes
All results have the same noise vector and label condition, but have different continous vector.*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*
:---: | :---: | :---: | :---: | :---: |
infoGAN ||
|
|
#### Loss plot
*Name* | *Loss*
:---: | :---: |
GAN |![]()
LSGAN |![]()
WGAN |![]()
WGAN_GP |![]()
DRAGAN |![]()
EBGAN |![]()
BEGAN |![]()
CGAN |![]()
ACGAN |![]()
infoGAN |## Folder structure
The following shows basic folder structure.
```
├── main.py # gateway
├── data
│ ├── mnist # mnist data (not included in this repo)
│ ├── ...
│ ├── ...
│ └── fashion-mnist # fashion-mnist data (not included in this repo)
│
├── GAN.py # vainilla GAN
├── utils.py # utils
├── dataloader.py # dataloader
├── models # model files to be saved here
└── results # generation results to be saved here
```## Development Environment
* Ubuntu 16.04 LTS
* NVIDIA GTX 1080 ti
* cuda 9.0
* Python 3.5.2
* pytorch 0.4.0
* torchvision 0.2.1
* numpy 1.14.3
* matplotlib 2.2.2
* imageio 2.3.0
* scipy 1.1.0## Acknowledgements
This implementation has been based on [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections) and tested with Pytorch 0.4.0 on Ubuntu 16.04 using GPU.