This is the project for LS-GAN (Loss-Sensitive GAN)
Author: Guo-Jun Qi, Date: 1/9/2017, most recent update: 2/8/2017
Questions about the source codes can be directed to Dr. Guo-Jun Qi at [email protected] All copyrights reserved.
Please cite the following paper when referring to the following algorithms (LS-GAN and CLS-GAN)
Guo-Jn Qi. Loss-Sensitive Generative Adversarial Networks on Lipschitz Densities. arXiv:1701.06264 [pdf]
We are keeping updating this repository of source codes, and more results and algorithms will be released soon.
We now have a new project generalizing LS-GAN to a more general form, called Generalized LS-GAN (GLS-GAN). It unifies Wasserstein GAN as well as this LS-GAN in an integrated framework, along with a super class of GLS-GANs including various new GAN members to explore. Check the github project at https://github.com/guojunq/glsgan, and the Appendix D of the newly updated prepint
We also show an incomplete map of GANs at http://www.cs.ucf.edu/~gqi/GANs.htm, which plots the terrority of basic GANs in our view. We will update the map as more GAN territories are found.
1.Setup and download dataset
`mkdir celebA; cd celebA
Download imgalignceleba.zip from http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html under the link "Align&Cropped Images".
unzip img_align_celeba.zip; cd .. DATA_ROOT=celebA th data/crop_celebA.lua
2.Training the LS-GAN
DATA_ROOT=celebA dataset=folder th lsgan.lua
Please download bedroomtrainlmdb from http://lsun.cs.princeton.edu
Prepare the dataset following the instructions below
sudo apt-get install liblmdb-dev
luarocks install lmdb.torch luarocks install tds
cd lsun/train DATA_ROOT=. th lsun_index_generator.luaNow you should have bedroomtrainlmdbhasheschartensor.t7 in lsun/train
DATA_ROOT=lsun th lsgan.lua
To display images during training and generation, we will use the display package.
luarocks install https://raw.githubusercontent.com/szym/display/master/display-scm-0.rockspec
Download and prepare datasets
torch-rocks install https://raw.github.com/andresy/mnist/master/rocks/mnist-scm-1.rockspec
Now you should be able to run clsgan.lua now. Select the dataset you want to use. For example you want to run MNIST to generate handwritten digits according to ten digit classes. Then you can run the following command line
dataset=mnist th clsgan.lua
For the other parameters you can set, please refer to the script in clsgan.lua.
parts of codes are reused from DCGAN at https://github.com/Newmu/dcgan_code
the code downloading cifar10 is available at https://github.com/soumith/cifar.torch
the code downloading SVHN: http://ufldl.stanford.edu/housenumbers/