SegmentationMask<T>

Models & Types · AiDotNet.ComputerVision.Segmentation.Common

Represents a single segmentation mask with associated metadata.

For Beginners

A segmentation mask is a binary image where each pixel is either part of the object (1) or not (0). This class wraps a mask with useful metadata like the object’s class, confidence score, area, and bounding box.

Constructors

Constructor Summary
SegmentationMask(Tensor<T> mask, int classId, double score) Creates a new segmentation mask.

Properties

Property Summary
Tensor<T> Mask { get; set; } Binary mask tensor [H, W] where values > 0 indicate the segmented region.
ValueTuple<double, double>? Centroid { get; set; } Centroid (x, y) of the mask.
bool IsThing { get; set; } Whether this mask represents a “thing” (countable object) or “stuff” (amorphous region).
double PredictedIoU { get; set; } IoU prediction score (if the model supports it).
double Score { get; set; } Confidence score in [0, 1].
double StabilityScore { get; set; } Stability score measuring mask consistency under perturbations (SAM-style).
double[] BoundingBox { get; set; } Bounding box [x1, y1, x2, y2] in pixel coordinates.
int Area { get; set; } Area of the mask in pixels.
int ClassId { get; set; } Class ID of the segmented object.
int InstanceId { get; set; } Instance ID (unique per instance for instance/panoptic segmentation).
int TrackingId { get; set; } Object tracking ID (for video segmentation across frames).
string ClassName { get; set; } Class name (if available).