GroundedSAM2Options

Options & Configuration · AiDotNet.VisionLanguage.Grounding

Configuration options for Grounded SAM 2: Grounding DINO finds the boxes a caption names, and SAM 2 segments each box.

Inheritance: ModelOptions → GroundedSAM2Options

For Beginners

These options configure the two models Grounded SAM 2 runs one after the other.

How It Works

The defaults are the official demo’s (IDEA-Research/Grounded-SAM-2, grounded_sam2_local_demo.py): Grounding DINO-T with box and text thresholds 0.35 and 0.25, and SAM 2.1 Hiera-L (sam2.1_hiera_large: blocks 2, 6, 36, 4; widths 144 to 1152; heads 2 to 16; windows 8, 4, 16, 8; global attention in blocks 23, 33 and 43) at 1024 px.

Constructors

Constructor Summary
GroundedSAM2Options() Initializes a new instance with default values.
GroundedSAM2Options(GroundedSAM2Options other) Initializes a new instance by copying from another instance.

Properties

Property Summary
GroundingDINOOptions Detector { get; set; } Gets or sets the detector’s options (Grounding DINO-T by default).
double MaskThreshold { get; set; } Gets or sets the mask logit above which a pixel belongs to the mask (0, the image predictor’s).
int SamDecoderHeads { get; set; } Gets or sets the mask decoder’s attention heads (8).
int SamDecoderMlpDim { get; set; } Gets or sets the mask decoder’s feed-forward width (2048).
int SamDim { get; set; } Gets or sets the width of SAM 2’s neck, prompt encoder and mask decoder (256).
int SamImageSize { get; set; } Gets or sets the side SAM 2 resizes every image to (1024).
int SamIouHiddenDim { get; set; } Gets or sets the IoU and object-score heads’ hidden width (256).
int SamMaskInChannels { get; set; } Gets or sets the channels of the prompt encoder’s mask embedding (16).
int[] SamBlocksPerStage { get; set; } Gets or sets the Hiera blocks per stage (Hiera-L: 2, 6, 36, 4).
int[] SamEmbedDims { get; set; } Gets or sets the Hiera widths per stage (Hiera-L: 144, 288, 576, 1152).
int[] SamGlobalAttentionBlocks { get; set; } Gets or sets the Hiera blocks, counted from 0 over all stages, that attend globally (Hiera-L: 23, 33, 43).
int[] SamHeadsPerStage { get; set; } Gets or sets the Hiera heads per stage (Hiera-L: 2, 4, 8, 16).
int[] SamWindowSizes { get; set; } Gets or sets the Hiera attention windows per stage (Hiera-L: 8, 4, 16, 8).