Segment Anything 2
Segment objects in an image.
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
Image to segment.
Hugging Face model ID used for image generation.
Nx2 array of point prompts to the model, where each point is in (X,Y) in pixels.
Labels for the point prompts, where 1 indicates a foreground point and 0 indicates a background point.
A length 4 array given as a box prompt to the model, in XYXY format.
A low-resolution mask input to the model, typically from a previous prediction iteration, with the form 1xHxW (H=W=256 for SAM).
If true, the model will return three masks for ambiguous input prompts, often producing better masks than a single prediction.
If true, returns un-thresholded mask logits instead of a binary mask.
If true, the point coordinates will be normalized to the range [0,1], with point_coords expected to be with respect to image dimensions.
Response
Response model for object segmentation.
The generated masks.
The model's confidence scores for each generated mask.
The raw, unnormalized predictions (logits) for the masks.
Was this page helpful?