SceneTextReader<T>

Models & Types · AiDotNet.ComputerVision.OCR.EndToEnd

End-to-end scene text reader that combines detection and recognition.

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

Implements: IGeneratedParameterRegistrar<T>

For Beginners

SceneTextReader is a complete OCR pipeline that first detects text regions in images (using CRAFT, EAST, or DBNet), then recognizes the text in each region (using CRNN or TrOCR). It’s designed for reading text in natural images like photos of signs, billboards, and product labels.

How It Works

Key features:

  • Two-stage pipeline: detection + recognition
  • Handles arbitrary text orientations
  • Works with curved and rotated text
  • Configurable detection and recognition models

Constructors

Constructor Summary
SceneTextReader(OCROptions<T> options) Creates a new scene text reader with default models.

Properties

Property Summary
ILossFunction<T> DefaultLossFunction { get; }
string Name { get; } Name of this scene text reader.

Methods

Method Summary
IFullModel<T, Tensor<T>, Tensor<T>> WithParameters(Vector<T> parameters)
OCRResult<T> ReadText(Tensor<T> image) Reads all text in an image.
Task LoadWeightsAsync(string detectorPath, string recognizerPath, CancellationToken cancellationToken) Loads pretrained weights.
Tensor<T> Predict(Tensor<T> input) Runs end-to-end OCR and returns region info as a tensor [numRegions, 6].
ValueTuple<string, T> ReadRegion(Tensor<T> croppedRegion) Reads text from a pre-detected region.
long GetParameterCount() Gets the total parameter count.
void Train(Tensor<T> input, Tensor<T> expectedOutput)