GithubHelp home page GithubHelp logo

hair_segmentation_matting's Introduction

Automatic Hair Segmentation and Matting

Contents

Normalization

The first step of the project is to detect a face region of the input image and normalize the images for future processing. We have adopted OpenCV DNN Facedetector. And based on the detection result the original image will be normalized as (512,512) size.

Segmentation

The next step is to segment the image into several parts such as background, body, hat, and hair region. By used BiseNet architecture and Pytorch Framework we have built the segmentation model. You can download face-parsing pre-trained model and save it in models, rename it as 'segmentation.pth'.

Matting

Based on the segmented result, we have prepared the tripmap image for image matting. By used VGG16 architecture and Pytorch Framework we have built the matting model. You can download matting pre-trained model and save it in models, rename it as 'matting.pth'.

Test

You have to prepare the images for testing, and copy them into the “images” folder. The result file will be saved in the “result” folder.

# evaluate using CPU
python test.py
Original Image Segmented and Alpha Image Composition Image
image image image
image image image
image image image

hair_segmentation_matting's People

Contributors

mostafa-shalaby84 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.