Table of Contents

Class InstanceMask<T>

Represents a single instance with bounding box and segmentation mask.

public class InstanceMask<T>

Type Parameters

T

The numeric type used for calculations.

Inheritance
InstanceMask<T>
Inherited Members

Constructors

InstanceMask(BoundingBox<T>, Tensor<T>, int, T)

Creates a new instance mask.

public InstanceMask(BoundingBox<T> box, Tensor<T> mask, int classId, T confidence)

Parameters

box BoundingBox<T>
mask Tensor<T>
classId int
confidence T

Properties

Box

Bounding box around the instance.

public BoundingBox<T> Box { get; set; }

Property Value

BoundingBox<T>

ClassId

Class ID of the detected instance.

public int ClassId { get; set; }

Property Value

int

ClassName

Class name (if available).

public string? ClassName { get; set; }

Property Value

string

Confidence

Detection confidence score.

public T Confidence { get; set; }

Property Value

T

Mask

Binary segmentation mask for this instance [height, width].

public Tensor<T> Mask { get; set; }

Property Value

Tensor<T>

MaskConfidence

Mask confidence score (if separate from detection confidence).

public T MaskConfidence { get; set; }

Property Value

T

Methods

ComputeMaskIoU(InstanceMask<T>, INumericOperations<T>)

Computes IoU with another instance mask.

public double ComputeMaskIoU(InstanceMask<T> other, INumericOperations<T> numOps)

Parameters

other InstanceMask<T>
numOps INumericOperations<T>

Returns

double

GetMaskArea(INumericOperations<T>)

Gets the mask area (number of positive pixels).

public int GetMaskArea(INumericOperations<T> numOps)

Parameters

numOps INumericOperations<T>

Returns

int