Skip to content
An implementation of Learning Residual Images for Face Attribute Manipulation
Branch: master
Clone or download
Latest commit 0751632 Apr 11, 2017
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 modify Apr 11, 2017

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.


  • Generate Eyeglasses gen
  • Remove Eyeglasses remove


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


  • 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:

    000053.jpg 0
    000093.jpg 0
    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


$ mkdir test_result
$ python 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.
You can’t perform that action at this time.