Skip to content

DIG-Beihang/Region-wise-Inpainting

Repository files navigation

Region-wise Generative Adversarial Image Inpainting for Large Missing Areas

This repository implements the training and testing code for "Region-wise Generative Adversarial Image Inpainting for Large Missing Areas". We propose an generic inpainting framework capable of handling with incomplete images on both continuous and discontinuous large missing areas, in an adversarial manner. We extend upon our prior conference publication "Coarse-to-Fine Image Inpainting via Region-wise convolutions and Non-local correlation" that mainly focuses on the discontinuous missing areas using the region-wise convolutions, suffering severe artifacts when the large missing areas are continuous. Some results are as follows.

RUN

Requirements:

The code was trained and tested with Tensorflow 1.x.0.CUDA 9.0 ,Python 3.6

  • Install python3.

  • Install tensorflow (tested on Release 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0).

  • clone this repo

    git clone https://github.com/vickyFox/Region-wise-Inpainting.git
    cd  Region-wise-Inpainting Private
    

Datasets

  • Face dataset: 28000 training images and 2000 test images from CelebA-HQ
  • Paris dataset: 14900 training images and 100 test images from Paris
  • natural images: original training images and sampled test images(images sampled from the origin testing images) from Places2

Training

  • Download vgg16.npy and put it under /vgg.
  • Prepare training images.
  • Run python train.py --train_data_path your_image_path --output your_output_path
  • Run python train.py -h to get more command line arguments

Testing

python test.py --test_data_path your_data_path --mask_path your_mask_path --model_path pretrained_model

  • We provide the pretrained models incuding celebA-HQ, Paris and Places2.
  • The default results will be saved under the results folder. You can set --file_out to choose a new path.

Pretrained

Download the pre-trained models and put them under the default directory \models or any other path you want.

Our main novelty of this project is the ability to handle with incomplete images on both continuous and discontinuous large missing areas.

Citing

@ARTICLE{2019arXiv190912507M,
       author = {{Ma}, Yuqing and {Liu}, Xianglong and {Bai}, Shihao and {Wang}, Lei and
         {Liu}, Aishan and {Tao}, Dacheng and {Hancock}, Edwin},
        title = "{Region-wise Generative Adversarial ImageInpainting for Large Missing Areas}",
      journal = {arXiv e-prints},
     keywords = {Computer Science - Computer Vision and Pattern Recognition},
         year = "2019",
        month = "Sep",
          eid = {arXiv:1909.12507},
        pages = {arXiv:1909.12507},
archivePrefix = {arXiv},
       eprint = {1909.12507},
 primaryClass = {cs.CV},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2019arXiv190912507M},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@inproceedings{ma2019inpainting,
  title={Coarse-to-Fine Image Inpainting via Region-wise Convolutions and Non-Local Correlation.},
  author={Yuqing Ma and Xianglong Liu and Shihao Bai and Lei Wang and Dailan He and Aishan Liu},
  booktitle={IJCAI},
  year={2019}
}

About

Region-wise GAN, image inpainting

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages