VisionTaskModelBase<T>

Base Classes · AiDotNet.ComputerVision

The training and state plumbing the vision task families share: object detectors, text detectors and text recognisers (ObjectDetectorBase, TextDetectorBase, OCRBase).

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

Known derived types: OCRBase<T>, ObjectDetectorBase<T>, TextDetectorBase<T>

How It Works

Each family used to carry its own copy of the following:

  • The raw-output training step.
  • The typed-target step: annotations, the model’s target assignment and the model’s loss.
  • The last-loss record.
  • The training-mode flag.
  • The input-shape memory that lets a rebuilt copy size its lazy layers before its state is

restored.

Only the object detectors had the typed step, so text detection and recognition could not train on annotations at all.

A family supplies two hooks. TrainingForward is the forward a raw step regresses; it defaults to Predict, and recognisers use their logits. DeferredParameterProbeShape is the zero input that resolves shape-deferred layers.

Properties

Property Summary
ILossFunction<T> DefaultLossFunction { get; }

Methods

Method Summary
IFullModel<T, Tensor<T>, Tensor<T>> WithParameters(Vector<T> parameters)
T GetLastLoss() Gets the loss of the most recent training step, measured on that step’s input before its update (zero before the first step).
byte[] Serialize()
void SetTrainingMode(bool training) Switches training mode.
void Train(Tensor<T> input, Tensor<T> expectedOutput) Runs one training step against the raw output of TrainingForward.