Skip to content

YooJiHyeong/SinIR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SinIR (Official Implementation)

Requirements

To install requirements:

pip install -r requirements.txt

We used Python 3.7.4 and f-strings which are introduced in python 3.6+

Training

To train a model, write a proper yaml config file in 'config_train' folder (sample yaml files provided in the config_train folder), and run this command:

python train.py <gpu_num> -y <yaml_file_in_'config_train'_folder>

For example, if you want to train a model with config_train/photo.yaml on gpu 0, run:

python train.py 0 -y photo

This will output a trained model, training logs, training output images and so on, to a subdirectory of 'outs' folder with proper naming and numbering which are used for inference.

Note that even though we provide one yaml file for each task, they can be used interchangeably, except few tasks.

You can copy and modify them depending on your purpose. Detailed explanation about configuration is written in the sample yaml files. Please read through it carefully if you need.

Inference

To carry out inference (i.e., image manipulation), you can specify inference yaml files in training yaml files. Please see provided sample training yaml files.

Or alternatively you can run this command:

python infer.py <output_dirnum> <gpu_num> -y <yaml_file_in_config_folder>

For example, if you want to carry out inference with a trained model numbered 002, with config_infer/photo_infer.yaml on gpu 0, run:

python infer.py 2 0 -y photo_infer

Then it will automatically find an output folder numbered 002 and conduct image manipulation, saving related results in the subdirectory.

Note that duplicated numbering (which can be avoided with a normal usage) will incur error. In this case, please keep only one output folder.

We also provide sample yaml files for inference which are paired with yaml files for training. Feel free to copy and modify depending on your purpose.

Acknowledgement

This repository includes images from:

  1. https://www2.eecs.berkeley.edu/Research/Projects/CS/vision/bsds/ (BSD dataset)
  2. https://github.com/luanfujun/deep-painterly-harmonization/ (https://arxiv.org/abs/1804.03189)
  3. https://github.com/luanfujun/deep-photo-styletransfer (https://arxiv.org/abs/1703.07511)
  4. The Web (free images)

This repository includes codes snippets from:

  1. SSIM: https://github.com/VainF/pytorch-msssim
  2. Anti-aliasing + Bicubic resampling: https://github.com/thstkdgus35/bicubic_pytorch
  3. dilated mask: https://github.com/tamarott/SinGAN

About

Official implementation of "SinIR: Efficient General Image Manipulation with Single Image Reconstruction" (ICML 2021)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages