GithubHelp home page GithubHelp logo

ipsych / adv-attribute-disentanglement Goto Github PK

View Code? Open in Web Editor NEW

This project forked from james-oldfield/adv-attribute-disentanglement

0.0 1.0 0.0 2.95 MB

Code to reproduce the results in the paper "Adversarial Learning of Disentangled and Generalizable Representations for Visual Attributes"

Python 100.00%

adv-attribute-disentanglement's Introduction

Adversarial Learning of Disentangled and Generalizable Representations for Visual Attributes

Code to reproduce the results in the paper "Adversarial Learning of Disentangled and Generalizable Representations for Visual Attributes". We propose a method for learning generalizable and disentangled latent representations that can be utilized for tasks including intensity-preserving multi-attribute image transfer.

dependencies

$ pip install natsort funcy tensorflow==1.4.0

Attribute Transfers

To replicate our test set attribute transfers for the expression attribute:

(1) prepare data

Assuming you have the datasets downloaded locally, prepare them with:

# BU-3DFE:
$ python scripts/prepare_bu.py --data_path="/bu/root/directory/"
# MultiPIE:
$ python scripts/prepare_multi.py --data_path="/multipie/root/directory/"
# RaFD:
$ python scripts/prepare_rafd.py --data_path="/rafd/root/directory/"

See ./scripts/readme.md for additional information on expected vendor structure of root folders.

(2) Download the pre-trained models

Download the pre-trained models for all datasets with the following:

$ wget -r -np -nH --cut-dirs=2 -R *index* http://igor.gold.ac.uk/~joldf001/adv-dis/checkpoints/

(2) Generate the transfers

Use the script below to replicate our test set expression transfers for a particular target image:

$ python experiments/generate_transfers.py \
  --from_checkpoint="checkpoints/bu/model.ckpt-75" \
  --input_files="./data-bu/test/0061-0004-0000-1548.jpg" \
  --target_files="./data-bu/test/" \
  --n_attributes=2 \
  --attribute_names="id,exp" \
  --db="bu"

or transfer expressions onto the entire e.g. test split:

$ python experiments/generate_transfers.py \
  --from_checkpoint="checkpoints/multi/2-att/model.ckpt-75" \
  --input_files="./data-multi/test/" \
  --target_files="./data-multi/train/" \
  --n_attributes=2 \
  --attribute_names="id,exp" \
  --db="multi"

Joint Interpolation and Transfer

To jointly interpolate between expression encodings, and simultaneously transfer the resulting convex combination onto a new identity, run the following:

python experiments/generate_exp_interpolations.py \
  --from_checkpoint="checkpoints/multi/2-att/model.ckpt-75" \
  --input_files="./data-multi/train/" \
  --n_attributes=2 \
  --attribute_names="id,exp" \
  --db="multi"

Citation

If this work is useful for your research, please cite our paper:

@ARTICLE{arXiv190404772O2019,
  author = {{Oldfield}, James and {Panagakis}, Yannis and {Nicolaou}, Mihalis A.},
  title = "{Adversarial Learning of Disentangled and Generalizable Representations for Visual Attributes}",
  journal = {arXiv:1904.04772 [cs.CV]},
  year = "2019",
}

adv-attribute-disentanglement's People

Contributors

james-oldfield avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.