yjg30737 / pyqt-remove-background-from-image

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

License:MIT License


Languages

Language:Python 100.0%