Table of Contents

Class PrototypeMaskHead<T>

Prototype-based mask head for YOLO and SOLOv2.

public class PrototypeMaskHead<T>

Type Parameters

T

The numeric type used for calculations.

Inheritance
PrototypeMaskHead<T>
Inherited Members

Remarks

For Beginners: Instead of predicting masks directly for each instance, prototype-based methods predict a set of prototype masks and per-instance coefficients. The final mask is a linear combination of prototypes weighted by coefficients.

Constructors

PrototypeMaskHead(int, int)

Creates a new prototype mask head.

public PrototypeMaskHead(int inChannels, int numPrototypes = 32)

Parameters

inChannels int

Number of input feature channels.

numPrototypes int

Number of prototype masks to generate.

Properties

NumPrototypes

Number of mask prototypes.

public int NumPrototypes { get; }

Property Value

int

Methods

AssembleMask(Tensor<T>, Tensor<T>)

Assembles instance mask from prototypes and coefficients.

public Tensor<T> AssembleMask(Tensor<T> prototypes, Tensor<T> coefficients)

Parameters

prototypes Tensor<T>

Prototype masks [1, num_prototypes, h, w].

coefficients Tensor<T>

Mask coefficients [num_prototypes].

Returns

Tensor<T>

Instance mask [h, w].

GeneratePrototypes(Tensor<T>)

Generates prototype masks from feature map.

public Tensor<T> GeneratePrototypes(Tensor<T> features)

Parameters

features Tensor<T>

Feature map [batch, channels, height, width].

Returns

Tensor<T>

Prototype masks [batch, num_prototypes, height, width].

GetParameterCount()

Gets the total parameter count.

public long GetParameterCount()

Returns

long

ReadParameters(BinaryReader)

Reads parameters from binary reader.

public void ReadParameters(BinaryReader reader)

Parameters

reader BinaryReader

WriteParameters(BinaryWriter)

Writes parameters to binary writer.

public void WriteParameters(BinaryWriter writer)

Parameters

writer BinaryWriter