/dcgan.caffe

A pure caffe-python implementation of DC-GAN

Primary LanguagePython

dcgan.caffe: A pure caffe-python implementation of DC-GAN

As far as I know, there is no light-weight implementation of DCGAN based on caffe.

Inspired by DeePSiM implementation, a few lines of python code can train the dcgan model quickly without any hack in caffe core lib (Dosovitskiy has already done this. However, I think the code could be merged back to master branch).

Dependency

You will need to compile the deepsim-caffe-branch. And make sure your PYTHONPATH point to it.

The deepsim-caffe only support cudnn-4.0. If disable the cudnn engine and replace some convolution layers with the master branch, a latest cudnn and cuda will work fine.

Training

For face generator, please prepare celebA dataset as the link said. Then make a train list file and put it in the data.prototxt.

Just typing

python train.py

Train file list

Each line has two columns seperated by space. The second column indicates the label of the corresponding image. Actually the label could be all zeros, since the training only need the images themselves to be the targets.

The file should look like

/data/Repo/dcgan.torch/celebA/img_align_celeba/000001.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000002.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000003.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000004.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000005.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000006.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000007.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000008.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000009.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000010.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000011.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000012.jpg 0
/data/Repo/dcgan.torch/celebA/img_align_celeba/000013.jpg 0
...

Trouble shooting

Visualization

To view the model result by

python generate.py generator.prototxt snapshots_test/4000/generator.caffemodel

The visualizations of the models at iteration 3000 and 4000 are as following:

3000

4000