generate

Segment Anything 2

Changed on

Segment objects in an image.

post/segment-anything-2

Request

  • Base URL
    https://dream-gateway.livepeer.cloud
  • URL
    https://dream-gateway.livepeer.cloud/segment-anything-2
  • Auth
    HTTP bearer

Request body multipart/form-data

imagestring binary required

Image to segment.

model_idstring required

Hugging Face model ID used for image generation.

point_coordsstring

Nx2 array of point prompts to the model, where each point is in (X,Y) in pixels.

point_labelsstring

Labels for the point prompts, where 1 indicates a foreground point and 0 indicates a background point.

boxstring

A length 4 array given as a box prompt to the model, in XYXY format.

mask_inputstring

A low-resolution mask input to the model, typically from a previous prediction iteration, with the form 1xHxW (H=W=256 for SAM).

multimask_outputboolean

If true, the model will return three masks for ambiguous input prompts, often producing better masks than a single prediction.

return_logitsboolean

If true, returns un-thresholded mask logits instead of a binary mask.

normalize_coordsboolean

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

Successful Response

masksstring required

The generated masks.

scoresstring required

The model's confidence scores for each generated mask.

logitsstring required

The raw, unnormalized predictions (logits) for the masks.

Changes

    • breaking

      the response's property type changed from no type to object for status

    • breaking

      the response's property type changed from no type to object for status

    • breaking

      the response's property type changed from no type to object for status

    • info

      removed from the response property allOf list for the response status

    • info

      removed from the response property allOf list for the response status

    • info

      removed from the response property allOf list for the response status

    • info

      added the required property / to the response with the status

    • info

      added the required property / to the response with the status

    • info

      added the required property / to the response with the status

    • breaking

      the response's property type changed from object to no type for status

    • breaking

      the response's property type changed from object to no type for status

    • breaking

      the response's property type changed from object to no type for status

    • breaking

      removed the required property / from the response with the status

    • breaking

      removed the required property / from the response with the status

    • breaking

      removed the required property / from the response with the status

    • info

      added to the response property allOf list for the response status

    • info

      added to the response property allOf list for the response status

    • info

      added to the response property allOf list for the response status