This is an implementation of Globally and Locally Consistent Image Completion with PyTorch.
日本語README(追加予定)
gif: input -> masked -> output -> blackout
- Python 3
- PyTorch
- NumPy
- OpenCV
- pyamg (optional, but required for post-processing)
- scipy (optional, but required for post-processing)
This code can run without GPU.
Download the trained model to the current directory:
wget --continue -O completionnet_places2.t7 http://hi.cs.waseda.ac.jp/~iizuka/data/completionnet_places2.t7
Basic usage is:
python inpaint.py --input <input_image> --mask <mask_image>
The mask is a Black and White image. White is completed reagion. And, the mask should be the same size as the input image. If the mask is not specified, a mask with randomly generated holes will be used.
Mask example:
Other options:
--gpu
: Use GPU for the computation, however may not become faster. Defaults toFalse
.--postproc
: Able the post-processing(poisson blending). Dafaults toFalse
. This poisson blending script is forked from this repository.
For example:
python inpaint.py --input example.png --mask example_mask.png
Finally, please push this repository Star bottom! Thank you.
- This is developed on a Linux machine running Ubuntu 16.04.
- According to the original paper, this pre-trained model was trained on Places2 dataset and thus performance is for natural outdoor images.
- This script referenced here and here.
This work is licensed under the Creative Commons:
http://creativecommons.org/licenses/by-nc-sa/4.0/
Please cite the original paper in your publications:
@Article{IizukaSIGGRAPH2017,
author = {Satoshi Iizuka and Edgar Simo-Serra and Hiroshi Ishikawa},
title = {{Globally and Locally Consistent Image Completion}},
journal = "ACM Transactions on Graphics (Proc. of SIGGRAPH)",
year = 2017,
volume = 36,
number = 4,
pages = 107:1--107:14,
articleno = 107,
}