Skip to content

Segment Anything 2 Model

Version v1

Run Segment Anything 2, a zero-shot instance segmentation model, on an image.

** Dedicated inference server required (GPU recomended) **

You can use pass in boxes/predictions from other models to Segment Anything 2 to use as prompts for the model. If you pass in box detections from another model, the class names of the boxes will be forwarded to the predicted masks. If using the model unprompted, the model will assign integers as class names / ids.

Type identifier

Use the following identifier in step "type" field: roboflow_core/segment_anything@v1to add the block as as step in your workflow.

Properties

Name Type Description Refs
name str The unique name of this step..
version str Model to be used. One of hiera_large, hiera_small, hiera_tiny, hiera_b_plus.
threshold float Threshold for predicted masks scores.
multimask_output bool Flag to determine whether to use sam2 internal multimask or single mask mode. For ambiguous prompts setting to True is recomended..

The Refs column marks possibility to parametrise the property with dynamic values available in workflow runtime. See Bindings for more info.

Available Connections

Check what blocks you can connect to Segment Anything 2 Model in version v1.

The available connections depend on its binding kinds. Check what binding kinds Segment Anything 2 Model in version v1 has.

Bindings
Example JSON definition of step Segment Anything 2 Model in version v1
{
    "name": "<your_step_name_here>",
    "type": "roboflow_core/segment_anything@v1",
    "images": "$inputs.image",
    "boxes": "$steps.object_detection_model.predictions",
    "version": "hiera_large",
    "threshold": 0.3,
    "multimask_output": true
}