Skip to main content

Semantic Object Removal

Using semantic segmentation and in-painting to remove objects based on labels. Inspired by Inpaint Anything by Tao Yu et al. Using MaskFormer for semantic segmentation to select areas to remove using LaMa for in-painting.

Installation

Install the package.

python -m pip install semremover

Use the SemanticObjectRemover in your code.

from semremover import SemanticObjectRemover

sem_obj_remover = SemanticObjectRemover()
labels = ['car', 'minibike', 'van']
inpainted_image = sem_obj_remover.remove_objects_from_image("example.jpg", labels)

Development

Installation

Install the Python requirements.

python -m pip install -r requirements.txt

Usage

To use the script you can call it with various options. The first positional argument is the input path, which can point to either an image or a directory of images. To remove objects from a picture add them to the labels option when running the script. The default labels can be found in ./semremover/models/config/ade20k_labels.json.

Example

input

python -m semremover example/paris.jpg --labels car minibike van

A picture of a street lined with cars in Paris.

Output

A picture of the same street in paris with the cars digitally removed.

Metadata

Release files for semremover 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for semremover 1.0.0
File Size Uploaded
semremover-1.0.0.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for semremover 1.0.0
File Interpreter ABI Platform
semremover-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.0 kB

Release files / semremover-1.0.0.tar.gz

Download URL semremover-1.0.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6b5d5112b981bd6a8d803def2fc2d24b20097321b25dba116aaf79acd94940ff
BLAKE2b-256 checksum
How to use checksums
60f6d165e0837d1d890dbbc86edeaefc3da83d501aa75de73df914ed6024bb24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / semremover-1.0.0-py3-none-any.whl

Download URL semremover-1.0.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e1a5727b0942c0ec5f2ff9af997beb8015a44e7a9c878cb0afbea4a60c550d7
BLAKE2b-256 checksum
How to use checksums
b4f7b26cb96bc9cfab0274389de6bf177c35d06d7c7d19d8917077bf4562bc9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.4

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page