Skip to content

An implementation of Learning Residual Images for Face Attribute Manipulation

Notifications You must be signed in to change notification settings

Zhongdao/FaceAttributeManipulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An implementation of Learning Residual Images for Face Attribute Manipulation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages