ezsam

Extract foreground from images or video via text prompt


Keywords
GroundingDINO, Segment-Anything, SAM, SAM-HQ, Grounded-Segment-Anything, subject, object, foreground, background, filter, extract, select, remove, prompt, subtract, ai, image-editing, object-detection, segment, video-editing
License
AGPL-3.0-only
Install
pip install ezsam==0.3.0

Documentation

ezsam (easy segment anything model)

A command line and gui tool to segment images and video via text prompts.

Input images and videos, describe the subjects or objects you want to keep, and output new images and videos with the background removed.

Check out the docs! ezsam.org

Why?

Meta's Segment Anything is a powerful tool for separating parts of images, but requires coordinate prompts—either bounding boxes or points. And manual prompt generation is tedious for large collections of still images or video.

In contrast, text-based prompts describing the object(s) in the foreground to segment can be constant. Inspired by Grounded-Segment-Anything, this project tries to package a simpler to use tool.

If you're not interested in text-based prompts with Segment Anything, check out rembg.

How does it work?

The foreground is selected using text prompts to GroundingDINO to detect objects. Image segments are generated using Segment Anything or Segment Anything HQ (SAM-HQ).

Quick start

# Ubuntu 22.04, Python 3.9 - 3.11
pip install ezsam
sudo apt install ffmpeg imagemagick
ezsam --help
ezsam-gui

For more detailed info, see the documentation site here: ezsam.org