- I have adapted the original author's code:
https://github.com/martinarjovsky/WassersteinGAN - The file download_lsun.py comes from a nice repository for downloading LSUN dataset:
https://github.com/fyu/lsun - I have added massive comments for the code. Hope it beneficial for understanding the WGAN, especially for a beginner.
- CentOS Linux release 7.2.1511 (Core)
- python 3.6.5
- pytorch 1.0.0
- torchvision
- argparse
- os
- random
- json
- subprocess
- urllib
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.
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.
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.
- 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'.