Skip to content

Latest commit

 

History

History
136 lines (113 loc) · 3.3 KB

README.md

File metadata and controls

136 lines (113 loc) · 3.3 KB

FUNIT: Few-Shot Unsupervised Image-to-Image Translation

Project | Paper | Video (3m) | Demo | Previous Implementation | Two Minute Papers Video

teaser

License

Imaginaire is released under NVIDIA Software license. For commercial use, please consult [email protected]

Software Installation

For installation, please checkout INSTALL.md.

Hardware Requirement

We trained our model using an NVIDIA DGX1 with 8 V100 32GB GPUs. Training took about one week.

Training

FUNIT prefers the following data structure.

${TRAINING_DATASET_ROOT_FOLDER}
└───images_content
    └───content_001.jpg
    └───content_002.jpg
    └───content_003.jpg
    ...
└───images_style
    └───style_001.jpg
    └───style_002.jpg
    ...

Training data preparation

  • Download the dataset and untar the files.
python scripts/download_dataset.py --dataset animal_faces
  • Build the lmdbs
for f in train train_all val; do
python scripts/build_lmdb.py \
--config  configs/projects/funit/animal_faces/base64_bs8_class119.yaml \
--data_root dataset/animal_faces_raw/${f} \
--output_root dataset/animal_faces/${f} \
--overwrite
done

Training command

python -m torch.distributed.launch --nproc_per_node=8 train.py \
--config configs/projects/funit/animal_faces/base64_bs8_class119.yaml \
--logdir logs/projects/funit/animal_faces/base64_bs8_class119.yaml

Inference

FUNIT prefers the following file arrangement for testing.

${TEST_DATASET_ROOT_FOLDER}
└───images_content
    └───0001.jpg
    └───0002.jpg
    └───0003.jpg
    ...
└───images_style
    └───0001.jpg
    └───0002.jpg
    └───0003.jpg
    ...

The style in style image 0001.jpg will be transferred to the content image 0001.jpg.imaginaire

  • Download sample test data by running
python scripts/download_test_data.py --model_name funit
python inference.py --single_gpu \
--config configs/projects/funit/animal_faces/base64_bs8_class149.yaml \
--output_dir projects/funit/output/animal_faces

The results are stored in projects/funit/output/animal_faces

Below we show the expected style--content-output images.

Style Content Translation
style content output

Citation

If you use this code for your research, please cite our papers.

@inproceedings{liu2019few,
  title={Few-shot Unsueprvised Image-to-Image Translation},
  author={Ming-Yu Liu and Xun Huang and Arun Mallya and Tero Karras and Timo Aila and Jaakko Lehtinen and Jan Kautz.},
  booktitle={IEEE International Conference on Computer Vision (ICCV)}},
  year={2019}
}