SegmentationModelBase<T>

Base Classes · AiDotNet.ComputerVision.Segmentation.Common

Abstract base class for all segmentation models, providing common dual-mode (native + ONNX) infrastructure, batch handling, forward/backward passes, and serialization.

Inheritance: NeuralNetworkBase<T> → SegmentationModelBase<T>

Implements: ISegmentationModel<T>, IShapeContract

Known derived types: InstanceSegmentationBase<T>, MedicalSegmentationBase<T>, OpenVocabSegmentationBase<T>, PanopticSegmentationBase<T>, PromptableSegmentationBase<T>, ReferringSegmentationBase<T>, SemanticSegmentationBase<T>, VideoSegmentationBase<T>

For Beginners

This is the foundation for all segmentation models in the library. It handles the plumbing that every segmentation model needs:

  • Loading pre-trained ONNX models for fast inference
  • Native mode for training from scratch or fine-tuning
  • Converting images between batched and unbatched formats
  • Saving and loading model weights

You don’t use this class directly — instead, create a concrete model like SegFormer, Mask2Former, or SAM that extends this base class.

Properties

Property Summary
bool IsOnnxMode { get; }
bool SupportsTraining { get; }
int InputHeight { get; }
int InputWidth { get; }
int NumClasses { get; }

Methods

Method Summary
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) The output axes for a segmentation model, shared by every model in the family.
Tensor<T> Segment(Tensor<T> image)
void UpdateParameters(Vector<T> parameters)