/grabhuman

A deep learning based demo application to extract human portrait from image

Primary LanguageJupyter Notebook

grabhuman

grabhuman is a deep learning based application to extract human portrait from image. The application outputs a RGBA image in which the alpha mask is generated by a Semantic Segmenatation model. The model is based on MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications.

sample result, image from Google Image

The reposity includes a pretrained model and a flask based Web UI.


How to use

Requirements

Python 3.6 and it depends on the following packages listed:

  • Tensorflow==1.13.1
  • opencv-python
  • numpy
  • flask
  • pillow

You can install all those packages via pip.

pip install -r requirements 

If you use docker, you can install the environment from Dockerfile.

CLI

Please note the output image should be specified with a PNG extension

python grabhuman.py samples/ellie.jpg -o output.png

GUI

If you use docker, a Flask web server will be started by default after your container is running. Otherwise, you have to start the web server manually.

python flask/app.py

The port of Flask server is hardcoded to 8080. You can visit the home page via http://{remotehost}:8080/ after it started.

More samples

demo.ipynb is used to generate the results of sample images.

0 3 4 8 18

Furthermore, you can blur the background
7 19 or splash color only on human.
20 5

The sample images are downloaded from Google/Baidu Image. To be honest, some of downloaded images are discarded from samples due to the results are not good enough. :)