A modified reimplemented in pytorch of inpainting model in Free-Form Image Inpainting with Gated Convolution [http://jiahuiyu.com/deepfill2/]
A modified reimplemented in pytorch of inpainting model in Free-Form Image Inpainting with Gated Convolution [http://jiahuiyu.com/deepfill2/] This repo is transfered from the https://github.com/avalonstrel/GatedConvolution and https://github.com/JiahuiYu/generative_inpainting.
It is a model for image inpainting task. I implement the network structure and gated convolution in Free-Form Image Inpainting with Gated Convolution, but a little difference about the original structure described in Free-Form Image Inpainting with Gated Convolution.
BenchMark data and Mask data can be found in Google Drive
I provide a pre-trained Baidu, Google model on Places2 256x256 dataset, (but unfortunately only the coarse network can be loaded since I change the network structure after the pre-train process, in fact the coarse network also work).
You should provide a file containing file paths you want to test following the form of
Change the parameters in config/testplaces2sagan.yml About the image
About the mask
The mask file should be a pkl file containing a numpy.array.
The MODELRESTORE should be set to the path of the pre-trained model. After successfully running, you can find the results in resultlogs/MODEL_RESTORE
To train your own model with some other dataset you can
By providing the
About the mask
And in training you can use random free-form mask or random rectangular mask. I use random free-form mask. If you want use random rectangular mask you need to change the process in trainsagan.py(line 163) and set MASKTYPES: ['random_bbox'].
Some detials about the training parameters is easy to understand as shown in config file.
tensorboard --logdir model_logs --port 6006to view training progress.
We provide two random mask generation function. * random free form masks
The parameters about this function are
Following the meaning in http://jiahuiyu.com/deepfill2/.
random rectangular masks
RANDOMBBOXSHAPE: [32, 32]
RANDOMBBOXMARGIN: [64, 64]
means the shape of the random bbox and the margin between the boarder. (The number of rectangulars can be set in inpaintdataset.py randombbox_number=5)
My project acknowledge the official code DeepFillv1 and SNGAN. Especially, thanks for the authors of this amazing algorithm.