Class PrototypeMaskHead<T>
- Assembly
- AiDotNet.dll
Prototype-based mask head for YOLO and SOLOv2.
public class PrototypeMaskHead<T>
Type Parameters
TThe 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
inChannelsintNumber of input feature channels.
numPrototypesintNumber of prototype masks to generate.
Properties
NumPrototypes
Number of mask prototypes.
public int NumPrototypes { get; }
Property Value
Methods
AssembleMask(Tensor<T>, Tensor<T>)
Assembles instance mask from prototypes and coefficients.
public Tensor<T> AssembleMask(Tensor<T> prototypes, Tensor<T> coefficients)
Parameters
prototypesTensor<T>Prototype masks [1, num_prototypes, h, w].
coefficientsTensor<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
featuresTensor<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
ReadParameters(BinaryReader)
Reads parameters from binary reader.
public void ReadParameters(BinaryReader reader)
Parameters
readerBinaryReader
WriteParameters(BinaryWriter)
Writes parameters to binary writer.
public void WriteParameters(BinaryWriter writer)
Parameters
writerBinaryWriter