Skip to content

Latest commit

 

History

History
53 lines (45 loc) · 1.96 KB

README.md

File metadata and controls

53 lines (45 loc) · 1.96 KB

Wasserstein GAN (WGAN)


Introduction

Environment & Requirements

  • CentOS Linux release 7.2.1511 (Core)
  • python 3.6.5
  • pytorch 1.0.0
  • torchvision
  • argparse
  • os
  • random
  • json
  • subprocess
  • urllib

Usage

Train WGAN with cifar10:

python3 main.py --dataset cifar10 --cuda

Two folders will be created, i.e., ./data & ./results. The ./data folder stores dataset.
The ./results folder contains two subfolders to store the generated samples and the trained models.
Training with lsun is also available.

Download lsun dataset:

python3 download_lsun.py --category bedroom 

Download data for bedroom and save it to ./data.
By replacing the option of ./--category, you can download data of each category in LSUN as well.
python3 download_lsun.py
Download the whole data set.

Generate images using the trained model:

python3 GenerateImg.py --config ./results/models/generator_config.json --weights ./results/models/netG_epoch_24.pth --output ./output --nimgs 100 --cuda

You can replace the above options as you want.

NOTE

  • I have treated the WGAN in terms of DCGAN as default.
  • You can test the WGAN without batch normalizaiton by adding an option '--noBN'.
  • You can also test WGAN in terms of MLP by adding an option '--MLP'.
  • CPU is supported but training is very slow. You can run the code without the option'--cuda'.

References

  1. https://github.com/martinarjovsky/WassersteinGAN
  2. https://github.com/fyu/lsun