GithubHelp home page GithubHelp logo

jdc08161063 / contentdisentanglement Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oripress/contentdisentanglement

0.0 2.0 0.0 3.37 MB

PyTorch implementation of "Emerging Disentanglement in Auto-Encoder Based Unsupervised Image Content Transfer"

Shell 1.58% Python 98.42%

contentdisentanglement's Introduction

Emerging Disentanglement in Auto-Encoder Based Unsupervised Image Content Transfer

PyTorch implementation of "Emerging Disentanglement in Auto-Encoder Based Unsupervised Image Content Transfer" (arxiv).

The network learns to disentangle content between a set and its subset. For example, given a set of people with glasses, and a set of people without, the network learns to map to decompose a face into 2 parts: one that contains information about glasses and one that contains information about everything else.

We can then transfer one person's glasses to many different people. In the image below, the glasses from the people in the left column are transferred to the people in the top row.

We can also do this for people who already have glasses, i.e. we replace their glasses with another pair:

Prerequisites

Get Started:

First, clone this repository by running:

git clone https://github.com/oripress/ContentDisentanglement

Download and Prepare the Data

Download the dataset by running the following command:

bash celeba_downloader.sh

Contrary to the notation used in the paper, A is the larger set, for example, A is people with glasses and B is people without. You can use the provided script preprocess.py to split celebA into the above format (with A and B based on the attribute of your choosing). For example, you can run the script using the following command:

python preprocess.py --root ./img_align_celeba --attributes ./list_attr_celeba.txt --dest ./glasses_train

You can also use your own custom dataset, as long as it adheres to the following format:

root/
     trainA/
     trainB/
     testA/
     testB/

You can then run the preprocessing in the following manner:

python preprocess.py --root ./custom_dataset --dest ./custom_train --folders

To Train

Run train.py. You can use the following example to run

python train.py --root ./glasses_data --out ./glasses_experiment --sep 25 --discweight 0.001

To Resume Training

Run train.py. You can use the following example to run

python train.py --root ./glasses_data --out ./glasses_experiment --load ./glasses_experiment --sep 25 --discweight 0.001

To Evaluate

Run eval.py. You can use the following example to run

python eval.py --dataroot ./glasses_data --out ./glasses_eval --sep 25 --num_display 10

Acknowledgements

The implementation is based on the architecture of Fader Networks. Some of the code is also based on the implementations of MUNIT and DRIT, and StarGAN.

contentdisentanglement's People

Contributors

oripress avatar

Watchers

James Cloos avatar  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.