GithubHelp home page GithubHelp logo

rahul-sindhu / pen-net-for-inpainting Goto Github PK

View Code? Open in Web Editor NEW

This project forked from researchmm/pen-net-for-inpainting

0.0 1.0 0.0 46.74 MB

[CVPR'2019] PEN-Net: Learning Pyramid-Context Encoder Network for High-Quality Image Inpainting

Home Page: https://arxiv.org/abs/1904.07475

License: MIT License

Python 100.00%

pen-net-for-inpainting's Introduction

PEN-Net for Image Inpainting

PEN-Net

Learning Pyramid-Context Encoder Network for High-Quality Image Inpainting
Yanhong Zeng, Jianlong Fu, Hongyang Chao, and Baining Guo.
In CVPR 2019.

Introduction

Existing inpainting works either fill missing regions by copying fine-grained image patches or generating semantically reasonable patches (by CNN) from region context, while neglect the fact that both visual and semantic plausibility are highly-demanded.

Our proposals combine these two mechanisms by,

  1. Cross-Layer Attention Transfer (ATN). We use the learned region affinity from high-lelvel feature maps to guide feature transfer in adjacent low-level layers in an encoder.
  2. Pyramid Filling. We fill holes multiple times (depends on the depth of the encoder) by using ATNs from deep to shallow.

Example Results

We re-implement PEN-Net in Pytorch for faster speed, which is slightly different from the original Tensorflow version used in our paper. Each triad shows original image, masked input and our result.

celebahq dtd facade places2

Run

  1. Requirements:
    • Install python3.6
    • Install pytorch (tested on Release 1.1.0)
  2. Training:
    • Prepare training images filelist [our split]
    • Modify celebahq.json to set path to data, iterations, and other parameters.
    • Our codes are built upon distributed training with Pytorch.
    • Run python train.py -c [config_file] -n [model_name] -m [mask_type] -s [image_size] .
    • For example, python train.py -c configs/celebahq.json -n pennet -m square -s 256
  3. Resume training:
    • Run python train.py -n pennet -m square -s 256 .
  4. Testing:
    • Run python test.py -c [config_file] -n [model_name] -m [mask_type] -s [image_size] .
    • For example, python test.py -c configs/celebahq.json -n pennet -m square -s 256
  5. Evaluating:
    • Run python eval.py -r [result_path]

Pretrained models

Download the models below and put it under release_model/

CELEBA-HQ | DTD | Facade | Places2

We also provide more results of central square below for your comparisons

CELEBA-HQ | DTD | Facade

TensorBoard

Visualization on TensorBoard for training is supported.

Run tensorboard --logdir release_model --port 6006 to view training progress.

Citation

If any part of our paper and code is helpful to your work, please generously cite with:

@inproceedings{yan2019PENnet,
  author = {Zeng, Yanhong and Fu, Jianlong and Chao, Hongyang and Guo, Baining},
  title = {Learning Pyramid-Context Encoder Network for High-Quality Image Inpainting},
  booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  pages={1486--1494},
  year = {2019}
}

License

Licensed under an MIT license.

pen-net-for-inpainting's People

Contributors

zengyh1900 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.