This is a background removal tool based on the U-2-Net model, designed for efficient and accurate segmentation of objects within images. The tool takes an input image and outputs a version with the background removed, providing a clean and isolated foreground.
- U-2-Net Model: Utilizes the U-2-Net architecture for image segmentation.
- Python 3.x
- Dependencies listed in requirements.txt
-
Clone the repository:
git clone https://github.com/ShivamMadlani/legendary-giggle cd legendary-giggle
-
Install dependencies(if running on a local machine):
pip install -r requirements.txt
-
Download u2net model:
- Download the model from here
- paste the downloaded file
u2net.pth
insaved_models/u2net
-
Run the background removal tool:
python main.py
-
Add the images into the
test_data/images/input
folder. -
The masked images will be generated inside
test_data/images/u2net_results
. -
The isolated image will be generated in
test_data/images/outpur
folder.
- U-2-Net Model: Link to U-2-Net Repository