Giter Club home page Giter Club logo

portrait_matting's Introduction

Portrait Matting

Deep Automatic Portrait Matting and Automatic Portrait Segmentation for Image Stylization implementation which predicts alpha or binary masks of portrait images automatically.

This is NOT official implementation.

Notice of License

This software is released under the GPL License except data_original directory.

Data under data_original directory is copied from the paper author's. Rights of the data belong to them.

We created our original alpha masks and the following results are generated by them.

Implemented Models

  • FCN8s for binary segmentation with RGB image
  • FCN8s for binary segmentation with RGB image, mean mask and grid images
  • FCN8s for trimap segmentation with RGB image, mean mask and grid images
  • FCN8s and matting layer with RGB image, mean mask and grid images

Testing Environments

  • OS: Ubuntu 16.04 and Latest Arch Linux
  • Python: 3.5
  • Chainer: 3.4.0
  • OpenCV: 3.4.0
  • Dlib: 19.9.0

Training

Training data which is contained this repository is binary mask for segmentation created by paper's author.

For training of trimap and matting, extra alpha masks are needed.

Preparation

# Download images from the internet.
$ python scripts/prepare_seg_dataset.py

# Generate mean masks and grids.
$ python scripts/prepare_seg_plus_dataset.py

# Generate trimaps from alpha masks. (extra alpha mask are needed)
$ python scripts/prepare_seg_tri_dataset.py

# Computes loss weight matrixs. (extra alpha mask are needed)
$ python scripts/prepare_matting_dataset.py

Training

$ python scripts/train.py --mode {seg,seg+,seg_tri,mat}

Testing

$ python scripts/train.py --mode {seg,seg+,seg_tri,mat} --model_path <path> -i <image path>

Results

Matting

First column is input image. Second column is output alpha mask. Third column is background replacement result.

ToDo

  • Collect more data.
  • Seek more effective training method about matting layer.
  • Tune hyper parameters automatically.

portrait_matting's People

Contributors

takiyu avatar heptaliane avatar

Watchers

James Cloos 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.