Skip to content
An implementation of Learning Residual Images for Face Attribute Manipulation
Branch: master
Clone or download
Latest commit 0751632 Apr 11, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
EyeglassesV2 clean up Apr 11, 2017
assets Init Apr 11, 2017
.gitignore clean up Apr 11, 2017
README.md modify README.md Apr 11, 2017

README.md

GAN Face Attribute Manipulation with Caffe Implementation

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.

Demo

  • Generate Eyeglasses gen
  • Remove Eyeglasses remove

Setup

You need to clone the caffe-deepsim-branch and compile py-caffe. Then replcace your caffe path in both train.py and generate.py.

Training

  • 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

Testing

$ mkdir test_result
$ python generate.py generator.prototxt ./snapshots_test/3000/generator.caffemodel

TODO

  • 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.
You can’t perform that action at this time.