- Notifications
You must be signed in to change notification settings - Fork26
PITI: Pretraining is All You Need for Image-to-Image Translation
License
PITI-Synthesis/PITI
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Official PyTorch implementation
Pretraining is All You Need for Image-to-Image Translation
Tengfei Wang,Ting Zhang,Bo Zhang,Hao Ouyang,Dong Chen,Qifeng Chen,Fang Wen
2022
paper |project website |video |online demo
We present a simple and universal framework that brings the power of the pretraining to variousimage-to-image translation tasks. You may try ouronline demo if interested.
Diverse samples synthesized by our approach.
git clone https://github.com/PITI-Synthesis/PITI.gitcd PITIconda env create -f environment.ymlPlease download our pre-trained models for bothBase model andUpsample model, and put them in./ckpt.
| Model | Task | Dataset |
|---|---|---|
| Base-64x64 | Mask-to-Image | Trained on COCO. |
| Upsample-64-256 | Mask-to-Image | Trained on COCO. |
| Base-64x64 | Sketch-to-Image | Trained on COCO. |
| Upsample-64-256 | Sketch-to-Image | Trained on COCO. |
If you fail to access to these links, you may alternatively find our pretrained modelshere.
We put some example images in./test_imgs, and you can quickly try them.
For COCO dataset, download the images and annotations from theCOCO webpage.
For mask-to-image synthesis, we use the semantic maps in RGB format as inputs. To obtain such semantic maps, run./preprocess/preprocess_mask.py (an example of the raw mask and the processed mask is given inpreprocess/example). Note that we do not need instant masks like previous works.
For sketch-to-image synthesis, we use sketch maps extracted by HED as inputs. To obtain such sketch maps, run./preprocess/preprocess_sketch.py.
Run the following script, and it would create an interactive GUI built by gradio. You can upload input masks or sketches and generate images.
pip install gradiopython inference.pyModifysample.sh according to the follwing instructions, and run:
bash sample.sh| Args | Description |
|---|---|
| --model_path | the path of ckpt for base model. |
| --sr_model_path | the path of ckpt for upsample model. |
| --val_data_dir | the path of a txt file that contains the paths for images. |
| --num_samples | number of images that you want to sample. |
| --sample_c | Strength of classifier-free guidance. |
| --mode | The input type. |
- Download and preprocess datasets. For COCO dataset, download the images and annotations from theCOCO webpage. Run
./preprocess/preprocess_mask.pyor./preprocess/preprocess_sketch.py - Download pretrained models by
python preprocess/download.py.
Taking mask-to-image synthesis as an example: (sketch-to-image is the same)
Modifymask_finetune_base.sh and run:
bash mask_finetune_base.shModifymask_finetune_upsample.sh and run:
bash mask_finetune_upsample.shIf you find this work useful for your research, please cite:
@article{wang2022pretraining, title = {Pretraining is All You Need for Image-to-Image Translation}, author = {Wang, Tengfei and Zhang, Ting and Zhang, Bo and Ouyang, Hao and Chen, Dong and Chen, Qifeng and Wen, Fang}, journal={arXiv:2205.12952}, year = {2022},}Thanks forGLIDE for sharing their code.
About
PITI: Pretraining is All You Need for Image-to-Image Translation
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors4
Uh oh!
There was an error while loading.Please reload this page.