Giter Site home page Giter Site logo

arjitkatare / hair-segmentation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thangtran480/hair-segmentation

0.0 0.0 0.0 178.31 MB

hair segmentation in mobile device

Home Page: https://arxiv.org/pdf/1712.07168.pdf

License: MIT License

Python 1.43% Jupyter Notebook 97.72% Kotlin 0.85%

hair-segmentation's Introduction

Hair Segmentation Realtime using Keras

The architecture was inspired by Real-time deep hair matting on mobile devices


Prerequisites

python 3.6

tensorflow-gpu==1.13.1
opencv-python==4.1.0.25
Keras==2.2.4
numpy==1.16.4
scikit-image==0.15.0

Dataset

Data structure training

├── my-data
│   ├── images
│   │   ├── 1.jpg
│   │   ├── 2.jpg
│   │   ├── 3.jpg
...
│   ├── masks
│   │   ├── 1.jpg
│   │   ├── 2.jpg
│   │   ├── 3.jpg
...

I've downloaded it and done the pre-processing. You find it in folder data/image (images original) and data/label(images mask)

Train model

# You can config train model in train.py
python train.py

Evaluate model

python evaluate.py

Run pretrain model

# Run test.py
python demo.py

You will see the predicted results of test image in test/data

Result

original result

original result

original result

Convert to Tensorflow Lite

  • Convert
# Convert Model to Mobile
python convert_to_tflite.py
  • Show shape model tflite
# Shape input and output shape model tflite 
python shape_input_output_tflite.py

About Keras

Keras is a minimalist, highly modular neural networks library, written in Python and capable of running on top of either TensorFlow or Theano. It was developed with a focus on enabling fast experimentation. Being able to go from idea to result with the least possible delay is key to doing good research.

Use Keras if you need a deep learning library that:

allows for easy and fast prototyping (through total modularity, minimalism, and extensibility). supports both convolutional networks and recurrent networks, as well as combinations of the two. supports arbitrary connectivity schemes (including multi-input and multi-output training). runs seamlessly on CPU and GPU. Read the documentation Keras.io

Keras is compatible with: Python 3.6.

TODO

  • Implement model using Keras
  • Convert model to Tensorflow Lite
  • Implement model to Android (DOING)

License

Copyright (c) 2019 Thang Tran Van

Licensed under the MIT License. You may not use this file except in compliance with the License

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.