This project uses Caffe python interface to implement Face Attribute Manipulation.
Thanks to the enhanced version of py-caffe in deepsim-caffe, a few lines of python code can train GANs quickly without any hack in caffe core lib. At present this project is incomplete yet, with only GAN loss + pixel loss + residual learning are implemented.
You need to clone the caffe-deepsim-branch and compile py-caffe. Then replcace your caffe path in both train.py and generate.py.
-
First we need to prepare the CelebA dataset since we need the annotation of face attributes. link
-
Divided the image list into two lists according to some specific attribute, e.g. Eyeglasses here. The two lists are in the following format:
Positive.txt 000053.jpg 0 000093.jpg 0 ... Negative.txt 000001.jpg 0 000002.jpg 0 ...
Note that the label 0 here is meaningless since we don't need them, we add labels here just for using the ImageDataLayer in Caffe. When the lists are ready you need to replace the source fileds in data_gen.prototxt and data_dual.prototxt with the prepared lists.
-
Run the training scripts
$ python train.py
$ mkdir test_result
$ python generate.py generator.prototxt ./snapshots_test/3000/generator.caffemodel
- Implement the perceptual loss.(I have implement a version but it seems not to work well)
- Adding dual learning.
- Change the network architecture to produce larger images(128x128), now the output is 64x64.