Home

Awesome

VQ-I2I

PyTorch implementaton of our ECCV 2022 paper "Vector Quantized Image-to-Image Translation". You can visit our project website here.

In this paper, we propose a novel unified framework which is able to tackle image-to-image translation, unconditional generation of input domains and diverse extension based on an existing image. <img src='fig/teaser.png' width="800px">

Paper

Vector Quantized Image-to-Image Translation
Yu-Jie Chen*, Shin-I Cheng*, Wei-Chen Chiu, Hung-Yu Tseng, Hsin-Ying Lee
European Conference on Computer Vision (ECCV), 2022 (* equal contribution)

Please cite our paper if you find it useful for your research.

@inproceedings{chen2022eccv,
 title = {Vector Quantized Image-to-Image Translation},
 author = {Yu-Jie Chen and Shin-I Cheng and Wei-Chen Chiu and Hung-Yu Tseng and Hsin-Ying Lee},
 booktitle = {European Conference on Computer Vision (ECCV)},
 year = {2022}
}

Installation and Environment

git clone https://github.com/cyj407/VQ-I2I.git
cd VQ-I2I
conda env create -f vqi2i_env.yml

Datasets

Please save the dataset images separately, e.g. Yosemite dataset:

First Stage

Train

Unpaired I2I task

python unpair_train.py --device <gpu_num> --root_dir <dataset_path> \
--dataset <dataset_name>\
--epoch_start <epoch_start> --epoch_end <epoch_end>

Paired I2I task

python pair_train.py --device <gpu_num> --root_dir <dataset_path> \
--dataset <dataset_name>\
--epoch_start <epoch_start> --epoch_end <epoch_end>

Test (unpaired I2I translation.)

python save_transfer.py --device <gpu_num> --root_dir <dataset_path> --dataset <dataset_name> \
--checkpoint_dir <checkpoint_dir> --checkpoint_epoch <checkpoint_epoch> \
--save_name <save_dir_name>

Using the pre-trained models

Second stage

Train

python autoregressive_train.py --device <gpu_num> --root_dir <dataset_path> \
--dataset <dataset_name> --first_stage_model <first_stage_model_path> \
--epoch_start <epoch_start> --epoch_end <epoch_end>

Test

Using the pre-trained models

Unconditional Generation

python save_uncondtional.py --device <gpu_num> \
--root_dir <dataset_path> --dataset <dataset_name> \
--first_stage_model <first_stage_model_path> \
--transformer_model <second_stage_model_path> \
--save_name <save_dir_name>

Image Extension/Completion

Image extension
python save_extension.py --device <gpu_num> \
--root_dir <dataset_path> --dataset <dataset_name> \
--first_stage_model <first_stage_model_path> \
--transformer_model <second_stage_model_path> \
--save_name <save_dir_name>
Image completion
python save_completion.py -device <gpu_num> \
--root_dir <dataset_path> --dataset <dataset_name> \
--first_stage_model <first_stage_model_path> \
--transformer_model <second_stage_model_path> \
--save_name <save_dir_name>

Transitional Stylization

Acknowledgments

Our code is based on VQGAN. The implementation of the disentanglement architecture is borrowed from MUNIT.