Table of Contents

Class SceneTextReader<T>

Namespace
AiDotNet.ComputerVision.OCR.EndToEnd
Assembly
AiDotNet.dll

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

public class SceneTextReader<T>

Type Parameters

T

The numeric type used for calculations.

Inheritance
SceneTextReader<T>
Inherited Members

Remarks

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.

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

Constructors

SceneTextReader(OCROptions<T>)

Creates a new scene text reader with default models.

public SceneTextReader(OCROptions<T> options)

Parameters

options OCROptions<T>

Properties

Name

Name of this scene text reader.

public string Name { get; }

Property Value

string

Methods

GetParameterCount()

Gets the total parameter count.

public long GetParameterCount()

Returns

long

LoadWeightsAsync(string, string, CancellationToken)

Loads pretrained weights.

public Task LoadWeightsAsync(string detectorPath, string recognizerPath, CancellationToken cancellationToken = default)

Parameters

detectorPath string
recognizerPath string
cancellationToken CancellationToken

Returns

Task

ReadRegion(Tensor<T>)

Reads text from a pre-detected region.

public (string text, T confidence) ReadRegion(Tensor<T> croppedRegion)

Parameters

croppedRegion Tensor<T>

Returns

(string Label, T Confidence)

ReadText(Tensor<T>)

Reads all text in an image.

public OCRResult<T> ReadText(Tensor<T> image)

Parameters

image Tensor<T>

Input image tensor [batch, channels, height, width].

Returns

OCRResult<T>

OCR result with all recognized text.