Skip to content
Semantic Image Inpainting
Branch: extensions
Clone or download
Latest commit c9201b0 Mar 12, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
graphs Added reading in of batch of images Jul 25, 2017
testimages Added reading in of batch of images Jul 25, 2017
.gitignore Initial Jul 8, 2017
LICENSE Release under MIT License Jul 13, 2017
requirements.txt Initial Jul 8, 2017 Initial merge for general image restoration with GANs Jul 13, 2018

Semantic Image Inpainting With Deep Generative Models and image restoration with GANS

[Inpainting CVPR2017] [Image Restore ICASSP2018]

Tensorflow implementation for semantic image inpainting:

Semantic Image Inpainting With Deep Generative Models

Raymond A. Yeh*, Teck Yian Lim*, Chen Chen, Alexander G. Schwing, Mark Hasegawa-Johnson, Minh N. Do

In CVPR 2017

* indicating equal contributions.


Implementation of proposed cost function and backpropogation to input.

In this code release, we load a pretrained DCGAN model, and apply our proposed objective function for the task of image completion.


To reproduce the CVPR2017 work, run the inpainting example.


  • Tensorflow >= 1.0
  • scipy + PIL/pillow (image io)
  • pyamg (for Poisson blending)

Tested to work with both Python 2.7 and Python 3.5


  • src/ - Main implementation
  • src/ - command line application
  • src/external - external code used. Citations in code
  • graphs/dcgan-100.pb - frozen pretrained DCGAN with 100-dimension latent space


Git doesn't work nicely with large binary files. Please download our weights from here, trained on the CelebA dataset.

Alternatively, train your own GAN using your dataset. Conversion from checkpoint to Tensorflow ProtoBuf format can be done with this script


Generate multiple candidates for completion:

python src/ --model_file graphs/dcgan-100.pb \
    --maskType center --in_image testimages/face1.png \
    --nIter 1000 --blend

Generate completions for multiple input images:

python src/ --model_file graphs/dcgan-100.pb \
    --maskType center --inDir testimages \
    --nIter 1000 --blend


    title={Semantic Image Inpainting with Deep Generative Models},
    author={Yeh$^\ast$, Raymond A. and Chen$^\ast$, Chen and Lim, Teck Yian and Schwing Alexander G. and Hasegawa-Johnson, Mark and Do, Minh N.},
    booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
    note = {$^\ast$ equal contribution},
You can’t perform that action at this time.