Code Monkey home page Code Monkey logo

resinpainting's Introduction

Residual Inpainting Using Selective Free-Form Attention

Prerequisites

  • Python 3.6
  • PyTorch 1.2
  • NVIDIA GPU + CUDA cuDNN
  • Some other frequently-used python packages, like opencv, numpy, imageio, etc.

Datasets prepration

We use CelebA, Paris Street View and Places2 datasets. The irregular mask dataset is available from here. After Downloading images and masks, create .filst file containing the dataset path in ./datasets/ (some examples have been given, refer to so).

Training

To continue training, first download pretrained models from my OneDrive, and place .pth files in the ./checkpoints directory.

Please edit the config file ./config.yml for your training setting. The options are all included in this file, see comments for the explanations.

Once you've set up, run the ./train.py script to launch the training.

python train.py

Testing

Please download pretrained models from my OneDrive, and place .pth files in the ./checkpoints directory.

Use .test.py for testing, you can directly run this script without any arguments:

python test.py

By default, this will inpaint the example images under the examples/celeba/images with the masks examples/celeba/masks. The output results will be saved in ./results.

Note that please use the original image rather than masked image as the input, our model will do the masking operation. Using masked image as input will introduce corss-color artifact since our model contains downsampling process. This issue will be fixed in the future.

For customized path, here are some args:

  • --G1 path to generator 1
  • --G2 path to generator 2
  • --input path to input images
  • --mask path to masks
  • --output path to results directory

Alternatively, you can also edit these options in the config file ./config.yml.

Acknowledgement

This project is modified based on the Edge-Connect Model proposed by Nazeri et al.

resinpainting's People

Contributors

cats-food 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.