Skip to content

Python desktop app example of remove background from image with OpenCV, PyTorch

License

Notifications You must be signed in to change notification settings

yjg30737/pyqt-remove-background-from-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyqt-remove-background-from-image

Python desktop app example of remove background from image with OpenCV, PyTorch

You need CUDA to run this.

Requirements

  • 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)

How to Run

  1. clone this repo.
  2. pip install -r requirements.txt to download necessary packages
  3. python main.py

After Running

image

  1. 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.
  1. 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.

Result