Python desktop app example of remove background from image with OpenCV, PyTorch
You need CUDA to run this.
- pillow - to save the image
- opencv-python - to handle the image file as numpy array and apply Gaussian Blur to make border smooth
- torch - to use CUDA
- torchvision - To use deeplab V3 (prominent image segmenation model made by Google)
- clone this repo.
pip install -r requirements.txt
to download necessary packages- python main.py
- First find the path which including images you want to remove the background.
- This package has the sample folder to make you get proper images (which is generated by Stable Diffusion) more conviniently.
- Press "Remove Background and Save!" button. It will make a backup folder and save original images to it and remove the background from the images in folder.