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
TThe numeric type used for calculations.
- Inheritance
-
NeckBase<T>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
configNeckConfigNeck configuration.
PANet(int[], int)
Creates a new Path Aggregation Network.
public PANet(int[] inputChannels, int outputChannels = 256)
Parameters
inputChannelsint[]Channel counts from backbone at each level.
outputChannelsintOutput channel count for all levels (default 256).
Properties
Name
Name of this neck architecture.
public override string Name { get; }
Property Value
NumLevels
Number of feature levels output by the neck.
public override int NumLevels { get; }
Property Value
OutputChannels
Number of output channels for all feature levels.
public override int OutputChannels { get; }
Property Value
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
featuresList<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
readerBinaryReaderThe binary reader to read from.
WriteParameters(BinaryWriter)
Writes all parameters to a binary writer for serialization.
public override void WriteParameters(BinaryWriter writer)
Parameters
writerBinaryWriterThe binary writer to write to.