YOLOv9<T>

Models & Types · AiDotNet.ComputerVision.Detection.ObjectDetection.YOLO

YOLOv9 object detector: the GELAN architecture with Programmable Gradient Information (PGI).

Inheritance: ModelBase<T, Tensor<T>, Tensor<T>> → VisionTaskModelBase<T> → ObjectDetectorBase<T> → YOLOv9<T>

Implements: IDetectionTrainingModel<T>

For Beginners

YOLOv9 builds its network from GELAN blocks (RepNCSPELAN4) and adds, only while training, an auxiliary branch with its own detection head. That branch feeds the main network reliable gradients (the paper’s “programmable gradient information”) and is dropped at inference, so it costs nothing at test time.

How It Works

Each ModelSize is its own paper configuration: Nano = t, Small = s, Medium = m, Large = c and XLarge = e. See YOLOv9Backbone for the per-size PGI branches. This model previously ran a YOLOv4/v5 CSPDarknet with a residual 3x3 convolution per level, and had no auxiliary branch.

Reference: Wang et al., “YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information”, 2024

Constructors

Constructor Summary
YOLOv9(NeuralNetworkArchitecture<T> architecture, ModelSize size, int numClasses) Creates a new YOLOv9 detector with default options derived from the architecture.
YOLOv9(ObjectDetectionOptions<T> options) Creates a new YOLOv9 detector with the specified options.

Properties

Property Summary
string Name { get; }

Methods

Method Summary
DetectionResult<T> Detect(Tensor<T> image, double confidenceThreshold, double nmsThreshold)
Task LoadWeightsAsync(string pathOrUrl, CancellationToken cancellationToken)
void SaveWeights(string path)
void Train(Tensor<T> input, Tensor<T> expectedOutput)
void TrainDetections(Tensor<T> input, DetectionTrainingBatch<T> targets) Trains both heads with task-aligned assignment, BCE classification, CIoU and distribution focal loss.