• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

thangtran480/hair-segmentation: hair segmentation in mobile device

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

thangtran480/hair-segmentation

开源软件地址(OpenSource Url):

https://github.com/thangtran480/hair-segmentation

开源编程语言(OpenSource Language):

Jupyter Notebook 76.5%

开源软件介绍(OpenSource Introduction):

Hair Segmentation Realtime using Keras

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

Build Status

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

install environment in conda:

conda env create -f environment.yml

Dataset

Download data CelebAMask-HQ and use preprocess in ./data/pre-process-data-CelebAMask-HQ.ipynb to create dataset

Data structure training

├── my-data
│   ├── train
│   │   ├──image
│   │   │   ├── 1.jpg
│   │   │   ├── 2.jpg
│   │   │   ├── 3.jpg
...
│   │   ├──mask
│   │   │   ├── 1.jpg
│   │   │   ├── 2.jpg
│   │   │   ├── 3.jpg
...
│   ├── val
...
│   ├── test
...

Train model

python train.py [--datadir PATH_FOLDER] [--batch_size BATCH_SIZE] [epochs EPOCHS] [--lr LEARNING_RATE] []

optional arguments:
    --datadir:        path to folder dataset, default ./data
    --batch_size:     batch size training, default 4
    --epochs:         number of eposchs, default 5
    --lr:             learning rate, default 1e-4
    --image_size:     size image input, default (224, 224)
    --use_pretrained: use pretrained, default false
    --path_model:     directory is saved checkpoint, default ./checkpoints
    --device:         device training model, default 0 (GPU:0), 1(GPU:1), -1(CPU)          

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




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap