Segment Anything V2

Description

This operator automatically segments salient objects in an image without requiring training for specific categories.

Overview

Used to automatically segment salient objects in images.

Scenarios

Suitable for general-purpose object segmentation when no class-specific training data is available.

Inputs and Outputs

Inputs

Image: Input RGB color image.

Prompt Point List: List of prompt point pixel coordinates, where each point is represented as (X, Y).

Prompt Box List: List of prompt boxes. Each prompt box is defined by four vertex coordinates, and the operator derives the corresponding top-left and bottom-right corners from them.

Outputs

Detection Results: A list of all segmented objects, including generated contours and confidence scores.

Parameters

Initialization Parameters

Weight File

Description

Upload the model file used for Segment Anything V2 inference.

Tuning Instructions

Smaller models run faster but may deliver lower accuracy. Larger models take more time and consume more GPU memory, but usually achieve better results:

Parameter Range

Values/Range:

  • .epicdl

  • .epicdlw

Enable Prompt

Description

Whether to use input prompts. If enabled, uses prompt boxes and prompt points (empty prompts yield empty output). If disabled, segmentation runs without prompts and any input prompts are ignored.

Parameter Range

Default: False

Multi-Mask Output

Description

Whether to output multiple masks per prompt. If True, each prompt generates 3 masks; if False, only one mask per prompt.

Parameter Range

Default: False

Enable GPU Acceleration

Description

Enable GPU inference. Requires a GPU environment on the host machine.

Parameter Range

Default: True

Sampling Point Density

Description

Specifies the number of points to be sampled along one side of the image for the automatic mask generator. The total number of sampling points is the square of this value.

Tuning Instructions

  • Increase: Denser probe points for better coverage of tiny objects or details, but increases inference count and processing time significantly.

  • Decrease: Sparser points for faster inference speed (e.g., halving the value can nearly double the speed), but may miss small objects.

Parameter Range

Values/Range: [1, 1000]

Default: 32

Minimum Area

Description

Sets the minimum permitted area (in pixels) for an output mask region, used to filter out noise or insignificant fragments.

Tuning Instructions

Segmentation results with an area smaller than this value will be discarded. Adjust based on image resolution and target object size.

Parameter Range

[0, 100000], Default: 100, Unit: pixels

Parameter Range

Values/Range: [0, 10000000]

Default: 100

Mask Quality Threshold

Description

Filtering threshold for mask prediction quality.

Tuning Instructions

Decrease if objects have holes or missing edges.

Parameter Range

[0, 1], Default: 0.8

Parameter Range

Values/Range: [0.0, 1.0]

Default: 0.8

NMS IoU Threshold

Description

IoU threshold for bounding box NMS. When two masks' bounding rectangles overlap beyond this value, the lower-quality one is removed. Higher: allows more overlap, retains more results. Lower: more aggressive deduplication, fewer but cleaner results.

Parameter Range

Values/Range: [0.0, 1.0]

Default: 0.7

Run Parameters

Mask Stability Threshold

Description

Threshold for internal stability score to filter low-quality masks.

Tuning Instructions

Higher values produce fewer results but more accurate contours. Lower values detect more small/blurry objects but may introduce more noise.

Parameter Range

[0, 1], Default: 0.95

Parameter Range

Values/Range: [0.0, 1.0]

Default: 0.95