MaskHead<T>

Models & Types · AiDotNet.ComputerVision.Segmentation.InstanceSegmentation

Mask prediction head for instance segmentation.

Implements: IParameterChunkSource<T>, IParameterLayoutSource, IParameterSource<T>

For Beginners

The mask head takes RoI-pooled features and predicts a binary segmentation mask for each class. It typically uses a series of convolutional layers followed by a transposed convolution for upsampling.

How It Works

Key features:

  • Multiple convolutional layers for feature processing
  • Upsampling via transposed convolution
  • Per-class mask prediction
  • Configurable mask resolution

Constructors

Constructor Summary
MaskHead(int inChannels, int numClasses, int maskResolution) Creates the Mask R-CNN mask head (He et al.

Properties

Property Summary
int MaskResolution { get; } The side of the predicted masks (28).
int RoiSize { get; } The side of the pooled RoI features this head reads: half the mask side (14).

Methods

Method Summary
Tensor<T> Forward(Tensor<T> roiFeatures) Predicts per-class mask logits on the tape.
Tensor<T> PredictMask(Tensor<T> roiFeatures, int classId) Predicts the mask of one class for one RoI, as probabilities.
long GetParameterCount() Gets the total parameter count.
void ReadParameters(BinaryReader reader) Reads the parameters from a binary stream.
void WriteParameters(BinaryWriter writer) Writes the parameters to a binary stream.