If this project has helped you, please consider making Sba Stuff a donation.
This is done on windows (Windows 10: x64 Bit) . If you want to implement follow same workflow.
- Python 3.7.9 (x64 Bit) Portable (Released On 2020-10-02 Size: 35.6 MB): Download From Source Forge
- Extract Downloaded Python Portable Exe. You Got lots of files and folders. Delete every folder except App/Python/
CPU support (I Used This):
Navigate to App/Python Folder. (You find Python.exe there.) Run CMD at that location and run following command
python.exe -m pip install rembg
GPU support (If you are rich enough to buy Nividia CUDA GPUS, you can also try this.):
pip install rembg[gpu]
Download ZIP of this file and extract contents in IBR Folder in App/Python/IBR/
Install Flask Using this Command. This is as same as you did for RemBG.
python.exe -m pip install flask
On Windows, Type %Username% in Address Bar of Explorer, Hit Enter.
Create a Folder Named `.u2net` there. Download all these Models given below and place ins this `.u2net` folder. (This can be downloaded by the code itself if you're connected to internet) The available models are:- u2net (download - alternative, source): A pre-trained model for general use cases.
- u2netp (download - alternative, source): A lightweight version of u2net model.
- u2net_human_seg (download - alternative, source): A pre-trained model for human segmentation.
- u2net_cloth_seg (download - alternative, source): A pre-trained model for Cloths Parsing from human portrait. Here clothes are parsed into 3 category: Upper body, Lower body and Full body.
Download this repo, And Create Folder IBR near python.exe (in App/Python/). And Extract Contents There. (Server.py and two folders i.e. Static and Template).
Run App By Full Path to Server.py (in Double Quotes) in IBR folder, while staying in Python.exe directory. Copy URL Given in Console CMD. And Paste in Browser.
Sometimes it is possible to achieve better results by turning on alpha matting. Example:
curl -s http://input.png | rembg i -a -ae 15 > output.png
Original | Without alpha matting | With alpha matting (-a -ae 15) |
Please contact me at sbastuff+github@gmail.com if you need help to put it on the cloud.
Liked some of my work? Buy me a coffee (or more likely a beer)
Copyright (c) 2011-present Simbha And Co. Pakistan
Licensed under MIT License