/image-background-changer

Change the background of an image using semantic segmentation

Primary LanguagePython

Background Changer using Semantic Segmentation with Tensorflow

This script changes the background of an input image with given background. You can read more about segmentation here

Setup

The script setup.sh downloads the trained model and sets it up so that the seg.py script can understand.

./setup.sh

Running the script

For better accuracy (slower approach) :

python3 seg_chng_background.py sample.jpg sample_background.jpeg sample_bgchanged.jpeg accurate

Use the script as specified below, to execute fast but lower accuracy model:

python3 seg_chng_background.py sample.jpg sample_background.jpeg sample_bgchanged.jpeg

Dependencies

tensorflow, PIL

Sample Result

Input

Background

Image with Background

Credits to

Susheelsk Code is originally utilized from https://github.com/susheelsk/image-background-removal