Skip to main content
Segment objects in image using text prompt.
Input images up to 1280 x 720 (width x height). Larger images are rejected with HTTP 413, not downscaled — resize first.

Parameters

ImageInput
required
RGB image as file path, URL, PIL Image, or numpy array.
str
required
Text description of objects to segment.
float | None
Optional confidence threshold (0.0-1.0) for filtering detections.
float | None
Optional text confidence threshold (0.0-1.0).
float | None
Optional Non-Maximum-Suppression threshold (0.0-1.0).
float | None
Optional timeout in seconds for the HTTP request.

Returns

np.ndarray: Binary segmentation mask as numpy array (H, W) with dtype uint8. Foreground pixels are 255, background pixels are 0.

Example

Combines Grounding DINO with SAM 2.

Example Output

GSAM2 text-prompted segmentation output