Tool for removing an object background and replacing it with neutral generated one.
git clone https://github.com/Tialo/replacer
cd replacer
pip install -r requirements.txt
python app.py
python -m replacer input.png output.png
- Background is removed with rembg
- New background is generated by Stable Diffusion model
- Object is pasted into new background
For a comparison of different background generation models, see this table.
.
├── replacer
│ ├── __init__.py
│ ├── __main__.py - CLI functionality
│ ├── app.py - Gradio application
│ ├── processing
│ │ ├── __init__.py
│ │ ├── adjust_image.py - Tools for adjusting image propertiers
│ │ ├── normalization.py - Different methods of color normalization
│ │ └── remove_background.py - Background removal functionality
│ ├── prompts.py - List of item categories and corresponding prompts
│ └── replacer.py - Main module for background replacement
└── requirements.txt