Skip to content

A PyTorch reimplementation of the paper Free-Form Image Inpainting with Gated Convolution (DeepFill v2) (https://arxiv.org/abs/1806.03589)

Notifications You must be signed in to change notification settings

ttaa9/deepfillv2-pytorch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deepfillv2-pytorch

A PyTorch reimplementation of the paper Free-Form Image Inpainting with Gated Convolution (DeepFillv2) (https://arxiv.org/abs/1806.03589) based on the original TensorFlow implementation.

Example images (raw | masked | inpainted):

Pretrained models

The models in networks_tf.py can be used with the weights from the official repository, which I have converted to PyTorch state dicts.

Download converted weights: Places2 | CelebA-HQ

Test the model

Before running the following commands make sure to put the downloaded weights file into the pretrained folder.

python test.py --image examples/inpaint/case1.png --mask examples/inpaint/case1_mask.png --out examples/inpaint/case1_out_test.png --checkpoint pretrained/states_places2.pth

Include the --tfmodel flag to test with the converted TensorFlow weights.

python test.py --tfmodel --image examples/inpaint/case1.png --mask examples/inpaint/case1_mask.png --out examples/inpaint/case1_out_test.png --checkpoint pretrained/states_tf_places2.pth

The Jupyter notebook test.ipynb shows how the model can be used.

Train the model

Train with options from a config file:

python train.py --config configs/train.yaml

Run tensorboard --logdir <your_log_dir> to see the TensorBoard logging.

Requirements

  • python3
  • pytorch
  • torchvision
  • numpy
  • Pillow
  • tensorboard
  • pyyaml

About

A PyTorch reimplementation of the paper Free-Form Image Inpainting with Gated Convolution (DeepFill v2) (https://arxiv.org/abs/1806.03589)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 88.9%
  • Jupyter Notebook 11.1%