Table of Contents

Class PANet<T>

Namespace
AiDotNet.ComputerVision.Detection.Necks
Assembly
AiDotNet.dll

Path Aggregation Network (PANet) for enhanced multi-scale feature fusion.

public class PANet<T> : NeckBase<T>

Type Parameters

T

The numeric type used for calculations.

Inheritance
PANet<T>
Inherited Members

Remarks

For Beginners: PANet improves upon FPN by adding a bottom-up pathway after the top-down pathway. This creates a bidirectional flow of information, allowing both high-level semantics to flow down and low-level details to flow up.

Key features: - FPN-style top-down pathway - Additional bottom-up pathway for better localization - Used in YOLOv4, YOLOv5, and many modern detectors

Reference: Liu et al., "Path Aggregation Network for Instance Segmentation", CVPR 2018

Constructors

PANet(NeckConfig)

Creates PANet from a configuration object.

public PANet(NeckConfig config)

Parameters

config NeckConfig

Neck configuration.

PANet(int[], int)

Creates a new Path Aggregation Network.

public PANet(int[] inputChannels, int outputChannels = 256)

Parameters

inputChannels int[]

Channel counts from backbone at each level.

outputChannels int

Output channel count for all levels (default 256).

Properties

Name

Name of this neck architecture.

public override string Name { get; }

Property Value

string

NumLevels

Number of feature levels output by the neck.

public override int NumLevels { get; }

Property Value

int

OutputChannels

Number of output channels for all feature levels.

public override int OutputChannels { get; }

Property Value

int

Remarks

Necks typically project all feature levels to the same number of channels (e.g., 256) to simplify the detection head.

Methods

Forward(List<Tensor<T>>)

Performs multi-scale feature fusion.

public override List<Tensor<T>> Forward(List<Tensor<T>> features)

Parameters

features List<Tensor<T>>

List of feature maps from the backbone, ordered from highest to lowest resolution.

Returns

List<Tensor<T>>

Fused feature maps at multiple scales.

Remarks

For Beginners: This method takes the raw features from the backbone and combines them across scales. After fusion, each feature level "knows about" features from other scales, making detection more accurate.

GetParameterCount()

Gets the total number of parameters in the neck.

public override long GetParameterCount()

Returns

long

Number of trainable parameters.

ReadParameters(BinaryReader)

Reads parameters from a binary reader for deserialization.

public override void ReadParameters(BinaryReader reader)

Parameters

reader BinaryReader

The binary reader to read from.

WriteParameters(BinaryWriter)

Writes all parameters to a binary writer for serialization.

public override void WriteParameters(BinaryWriter writer)

Parameters

writer BinaryWriter

The binary writer to write to.