Giter Site home page Giter Site logo

diaaesmail / chainer-partial_convolution_image_inpainting Goto Github PK

View Code? Open in Web Editor NEW

This project forked from seitaroshinagawa/chainer-partial_convolution_image_inpainting

1.0 2.0 0.0 1.59 MB

Reproduction of Nvidia image inpainting paper "Image Inpainting for Irregular Holes Using Partial Convolutions"

License: MIT License

Python 100.00%

chainer-partial_convolution_image_inpainting's Introduction

chainer-partial_convolution_image_inpainting

Reproduction of Nvidia image inpainting paper "Image Inpainting for Irregular Holes Using Partial Convolutions" https://arxiv.org/abs/1804.07723

1,000 iteration results (completion, output, mask) "completion" represents the input images whose masked pixels are replaced with the corresonded pixels of the output images iter_1000.jpg

10,000 iteration results (completion, output, mask)
iter_10000.jpg

100,000 iteration results (completion, output, mask)
iter_100000.jpg

Environment

  • python3.5.3
  • chainer4.0alpha
  • opencv (only for cv.imread, you can replace it with PIL)
  • PIL

How to try

Download dataset (place2)

Place2

Set dataset path

Edit common/paths.py

train_place2 = "/yourpath/place2/data_256"
val_place2 = "/yourpath/place2/val_256"
test_place2 = "/yourpath/test_256"

Preprocessing

In this implementation, masks are automatically generated in advance.

python generate_windows.py image_size generate_num

"image_size" indicates image size of masks.
"generate_num" indicates the number of masks to generate.

Default implementation uses image_size=256 and generate_num=1000.

#To try default setting
python generate_windows.py 256 1000

Note that original paper uses 512x512 image and generate mask with different way.

Run training

python train.py -g 0 

-g represents gpu option.(utilize gpu of No.0)

Difference from original paper

Firstly, check implementation FAQ

  1. C(0)=0 in first implementation (already fix in latest version)
  2. Masks are generated using random walk by generate_window.py
  3. To use chainer VGG pre-traied model, I re-scaled input of the model. See updater.vgg_extract. It includes cropping, so styleloss in outside of crop box is ignored.)
  4. Padding is to make scale of height and width input:output=2:1 in encoder stage.
  5. I use chainer.functions.unpooling_2d for upsampling. (you can replace it with chainer.functions.upsampling_2d)

other differences:

  • image_size=256x256 (original: 512x512)

Acknowledgement

This repository utilizes the codes of following impressive repositories

chainer-partial_convolution_image_inpainting's People

Contributors

seitaroshinagawa avatar

Stargazers

 avatar

Watchers

 avatar  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.