Segment objects using exactly one prompt type per call: text, points, or boxes. SAM3 offers two client methods:Documentation Index
Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
Use this file to discover all available pages before exploring further.
run()— Returns a single union mask. Use when you only need the combined segmentation.run_with_detections()— Returns the union mask plus per-instance masks, bounding boxes, and confidence scores. Use when you need individual object information (e.g. counting objects, filtering by confidence, or processing instances separately). Only available for text and box prompts — point prompts have no detection semantics.
Parameters
RGB image as file path, URL, PIL Image, or numpy array.
Text prompt describing objects to segment. Exclusive with
points/boxes. Also accepted as text_prompt.List of
[x, y] point coordinates. Exclusive with text/boxes. Requires labels. Also accepted as prompts.List of
[x0, y0, x1, y1] box coordinates. Exclusive with text/points. Requires labels.Required for
points/boxes. 1 = foreground, 0 = background.Optional HTTP timeout.
Returns — run()
np.ndarray — Binary union mask of shape (H, W) with dtype uint8. All matched instances are OR’d into a single mask. Foreground 255, background 0.
Returns — run_with_detections()
dict with keys:
union_mask— Combined binary mask(H, W), dtypeuint8(same asrun()output)masks— List of per-instance binary masks, each(H, W)dtypeuint8boxes— List of[x0, y0, x1, y1]bounding boxes (text/box prompts only)scores— List of confidence scores (sorted descending)
masks, boxes, and scores will be empty lists.
Example Output — run()

Example — run()
Use run() when you only need the combined mask — e.g. masking a region, computing area, or passing to a downstream model.
Example Output — run_with_detections()

Example — run_with_detections()
Use run_with_detections() when you need per-instance information — e.g. counting objects, filtering by confidence, or processing each instance separately. Works with text and box prompts only.