YOLOv12Seg<T>
Models & Types · AiDotNet.ComputerVision.Segmentation.InstanceSegmentation
YOLOv12-Seg: Attention-centric real-time instance segmentation.
Inheritance: NeuralNetworkBase<T> → SegmentationModelBase<T> → InstanceSegmentationBase<T> → YOLOv12Seg<T>
For Beginners
Real-time instance segmentation with attention. Autonomous vehicle perception.
Common use cases:
- Real-time instance segmentation with attention
- Autonomous vehicle perception
- Smart surveillance systems
- Industrial quality control
How It Works
Technical Details:
- Area-attention mechanism replacing standard self-attention
- R-ELAN (Residual Efficient Layer Aggregation Network) blocks
- FlashAttention-compatible efficient attention
- Native attention integration in YOLO architecture
Reference: Tian et al., “YOLOv12: Attention-Centric Real-Time Object Detectors”, arXiv 2025.
Example
// Create a YOLOv12-Seg model with attention-centric instance segmentation
var architecture = new NeuralNetworkArchitecture<double>(
inputType: InputType.ThreeDimensional,
taskType: NeuralNetworkTaskType.MultiClassClassification,
inputHeight: 640, inputWidth: 640, inputDepth: 3, outputSize: 80);
var model = new YOLOv12Seg<double>(architecture);
// Every tunable is now set through the options object; these are the defaults:
var custom = new YOLOv12Seg<double>(architecture,
options: new YOLOv12SegOptions { NumClasses = 80, DropRate = 0, ModelSize = YOLOv12SegModelSize.N });
// Or load a pre-trained ONNX model for autonomous vehicle perception
var onnxModel = new YOLOv12Seg<double>(architecture, "yolov12n-seg.onnx");
Constructors
| Constructor | Summary |
|---|---|
YOLOv12Seg(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, YOLOv12SegOptions options) |
Initializes YOLOv12Seg in native (trainable) mode. |
YOLOv12Seg(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, YOLOv12SegOptions options) |
Initializes YOLOv12Seg in ONNX (inference-only) mode. |
Methods
| Method | Summary |
|---|---|
InstanceSegmentationResult<T> DetectInstances(Tensor<T> image) |
|
ModelMetadata<T> GetModelMetadata() |
Collects metadata describing this model’s configuration. |