Skip to content
Pytorch implementation of of "Domain Intersection and Domain Difference" (ICCV 2019)
Python
Branch: master
Clone or download
Latest commit 3d083db Sep 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
models Initial Code Commit Aug 5, 2019
train Initial Code Commit Aug 5, 2019
DiagramsDomainIntersection.png Initial Code Commit Aug 5, 2019
README.md
eval.py Initial Code Commit Aug 5, 2019
preprocess.py Initial Code Commit Aug 5, 2019
utils.py Initial Code Commit Aug 5, 2019

README.md

Domain Intersection and Domain Difference (arxiv).

Pytorch Implementation of "Domain Intersection and Domain Difference" (ICCV 2019)

Prerequisites

Download and Prepare the Data

Download the celeba dataset. Create a celeb directory and place the img_align_celeba folder and list_attr_celeba.txt inside.

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 ./celeba/img_align_celeba --attributes ./celeba/list_attr_celeba.txt --dest ./smile_glasses

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 --config smile_glasses

To Train

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

python train.py --root ./smile_glasses --out ./smile_glasses_out

To Resume Training

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

python train.py --root ./smile_glasses --out ./smile_glasses_out --load ./smile_glasses 

To Evaluate

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

python eval.py --root ./smile_glasses --out ./smile_glasses_eval --sep 25 --num_display 10

Figure

Figure from paper describing the method:

Reference

If you found this code useful, please cite the following paper:

@inproceedings{Benaim2019DomainIntersectionDifference,
  title={Domain Intersection and Domain Difference},
  author={Sagie Benaim and Michael Khaitov and Tomer Galanti and Lior Wolf},
  booktitle={ICCV},
  year={2019}
}

Acknowledgements

The implementation is based on the architecture of Content Disentanglement.

You can’t perform that action at this time.