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
TThe 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
optionsOCROptions<T>
Properties
Name
Name of this scene text reader.
public string Name { get; }
Property Value
Methods
GetParameterCount()
Gets the total parameter count.
public long GetParameterCount()
Returns
LoadWeightsAsync(string, string, CancellationToken)
Loads pretrained weights.
public Task LoadWeightsAsync(string detectorPath, string recognizerPath, CancellationToken cancellationToken = default)
Parameters
detectorPathstringrecognizerPathstringcancellationTokenCancellationToken
Returns
ReadRegion(Tensor<T>)
Reads text from a pre-detected region.
public (string text, T confidence) ReadRegion(Tensor<T> croppedRegion)
Parameters
croppedRegionTensor<T>
Returns
- (string Label, T Confidence)
ReadText(Tensor<T>)
Reads all text in an image.
public OCRResult<T> ReadText(Tensor<T> image)
Parameters
imageTensor<T>Input image tensor [batch, channels, height, width].
Returns
- OCRResult<T>
OCR result with all recognized text.