/CK_Inpainting

Official Implementation of Learning Contextual Kernels for High Quality Image Inpainting

Primary LanguagePythonMIT LicenseMIT

Contextual Kernel Inpainting

Authors: Zhijie Wang & Hanqiu Deng & Binkai Tan

This repository contains the source code for the paper Learning Contextual Kernels for High Quality Image Inpainting (This work is done for ECE 644 Winter 2021, University of Alberta).

This work was previously submitted as a paper in 2021, however, it neither got accepted nor has follwo-up work. After all I think it worthes open-source and hope it could be useful to any future work.

We don't have any plan to relase the paper draft.

Overview

Datasets

We use FFHQ and ParisStreetView in our experiments. For the irregular masks, we use the test set of NVIDIA Irregular Mask Dataset.

Since we don't have the rights to hold any datasets, please download them from original sources.

For FFHQ dataset, you can use the .txt files under dataset/ffhq/ to get exactly same splits in our experiments. For ParisStreetView dataset, you should create your own data splits .txt files and put them under dataset/paris/.

Get Started

Environments

Basic environments: Python >= 3.6 and PyTorch >= 1.4.0.

Required packages:

pip install -r requirements.txt

Organize your dataset and codes as follows:


├── data
│   ├── ffhq
│   │   │── images1024x1024 # (1024*1024)
│   │   │── thumbnails128x128 # (128*128)
│   ├── paris
│   ├── mask
│   │   │── testing_mask_dataset
├── CK_Inpainting

Train

Replace {CONFIG} as ffhq_irregular, ffhq_suare, or paris.

Start a new training

python runner_inpainting.py --config={CONFIG}

Resume a previous training

Replace {CONFIG} as ffhq_irregular, ffhq_suare, or paris, {CHECKPOINTS_PATH} as the path of your checkpoints, init_lr as your learning rate after resuming.

python runner_inpainting.py --config={CONFIG} --weights={CHECKPOINTS_PATH} --init_lr={LEARNING_RATE}

Test

Replace {CONFIG} as ffhq_irregular, ffhq_suare, or paris, {CHECKPOINTS_PATH} as the path of your checkpoints.

python runner_inpainting.py --config={CONFIG} --test --weights={CHECKPOINTS_PATH}

Result1

Pre-trained Model

https://drive.google.com/drive/folders/10diAVDy2y2NtoGLYmoB-H4Spef8DbwJC?usp=sharing

License

CK_Inpainting is release under MIT license (see LICENSE).

Acknowledgement

We thank anonymous reviewers in ECE 644 Winter 2021 at the University of Alberta.

We thank the following open source projects and codes.