YOLOv9Seg<T>

Models & Types · AiDotNet.ComputerVision.Segmentation.InstanceSegmentation

YOLOv9-Seg: Instance segmentation with Programmable Gradient Information.

Inheritance: NeuralNetworkBase<T> → SegmentationModelBase<T> → InstanceSegmentationBase<T> → YOLOv9Seg<T>

For Beginners

YOLOv9-Seg extends the YOLOv9 object detector with a mask prediction branch for real-time instance segmentation. It uses Programmable Gradient Information (PGI) to preserve important information during training and GELAN (Generalized ELAN) for efficient feature aggregation.

Common use cases:

  • Real-time instance segmentation in video streams
  • Autonomous driving (detecting and masking cars, pedestrians)
  • Industrial inspection (defect detection with masks)
  • Robotics (object manipulation with precise boundaries)

How It Works

Technical Details:

  • Programmable Gradient Information (PGI) prevents information loss in deep networks
  • GELAN (Generalized ELAN) architecture for efficient feature aggregation
  • Achieves 43.5 mask mAP on COCO with real-time speed
  • Anchor-free detection head + YOLACT-style mask branch

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

Example

// Create a YOLOv9-Seg model with programmable gradient information
var architecture = new NeuralNetworkArchitecture<double>(
    inputType: InputType.ThreeDimensional,
    taskType: NeuralNetworkTaskType.MultiClassClassification,
    inputHeight: 640, inputWidth: 640, inputDepth: 3, outputSize: 80);
var model = new YOLOv9Seg<double>(architecture);
// Every tunable is now set through the options object; these are the defaults:
var custom = new YOLOv9Seg<double>(architecture,
    options: new YOLOv9SegOptions { NumClasses = 80, DropRate = 0.0, ModelSize = YOLOv9SegModelSize.C });
            
// Or load a pre-trained ONNX model for industrial inspection
var onnxModel = new YOLOv9Seg<double>(architecture, "yolov9c-seg.onnx");

Constructors

Constructor Summary
YOLOv9Seg(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, YOLOv9SegOptions options) Initializes YOLOv9-Seg in native (trainable) mode.
YOLOv9Seg(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, YOLOv9SegOptions options) Initializes YOLOv9-Seg in ONNX (inference-only) mode.

Methods

Method Summary
InstanceSegmentationResult<T> DetectInstances(Tensor<T> image)
ModelMetadata<T> GetModelMetadata() Collects metadata describing this model’s configuration.