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.
The reposity includes a pretrained model and a flask based Web UI.
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.
Please note the output image should be specified with a PNG extension
python grabhuman.py samples/ellie.jpg -o output.png
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.
demo.ipynb is used to generate the results of sample images.
Furthermore, you can blur the background
or splash color only on human.
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. :)