SAMOptions

Options & Configuration · AiDotNet.ComputerVision.Segmentation.Foundation

Configuration options for the Segment Anything Model (SAM).

Inheritance: ModelOptions → NeuralNetworkOptions → ModelHyperparameterOptions → SegmentationModelOptions → SAMOptions

For Beginners

SAM is Meta AI’s foundation model for image segmentation. Options inherit from NeuralNetworkOptions and can be extended with SAM-specific settings.

Constructors

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

Properties

Property Summary
SAMModelSize ModelSize { get; set; } Gets or sets which published size variant of the model to build.
double FocalAlpha { get; set; } Gets or sets focal loss’s class-balance parameter alpha.
double FocalGamma { get; set; } Gets or sets focal loss’s focusing parameter gamma.
double MaskDiceWeight { get; set; } Gets or sets the dice-loss weight in the mask objective.
double MaskFocalWeight { get; set; } Gets or sets the focal-loss weight in the mask objective.
int EncoderDepth { get; set; } Gets or sets the image encoder’s blocks (12, 24, 32; set by ModelSize).
int EncoderDim { get; set; } Gets or sets the image encoder’s width (ViT-B 768, ViT-L 1024, ViT-H 1280; set by ModelSize).
int EncoderHeads { get; set; } Gets or sets the image encoder’s attention heads (12, 16, 16; set by ModelSize).
int[] GlobalAttentionBlocks { get; set; } Gets or sets the encoder blocks that attend globally; the others attend within windows (set by ModelSize; each must be below EncoderDepth).

Methods

Method Summary
void Validate() Throws when a value on this instance cannot produce a working model.