OnDeviceOcrEngine class
A PdfOcrEngine that recognizes pages on device, with no network call
at recognition time - the model is downloaded once (see
PdfOcrModelManager) and then runs locally.
The page geometry and span mapping are OcrRunnerEngine's; this adds the native, downloaded-model construction.
Use OnDeviceOcrEngine.fromDownloadedModel for the batteries-included path (PP-OCR on ONNX Runtime from a downloaded PdfOcrModel), or the default constructor to plug in any runner.
- Inheritance
-
- Object
- OcrRunnerEngine
- OnDeviceOcrEngine
Constructors
- OnDeviceOcrEngine(OcrModelRunner runner, {double minConfidence = 0})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- minConfidence → double
-
Lines below this confidence are dropped before mapping.
finalinherited
- runner → OcrModelRunner
-
The inference backend.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → Future< void> -
Releases the backend.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recognize(
PdfOcrPageImage page) → Future< List< PdfOcrSpan> > -
Recognizes the text on
page. Returns onePdfOcrSpanper word (or line) with its user-space bounds and confidence.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromDownloadedModel(
PdfOcrModelManager manager, PdfOcrModel model, {double minConfidence = 0, bool useWorkerIsolate = true}) → Future< OnDeviceOcrEngine> -
Builds an engine that runs
modelfrom files already downloaded bymanageron ONNX Runtime. Throws PdfOcrModelException if the model is not downloaded. Inference runs on a long-lived worker isolate by default; setuseWorkerIsolatefalse only to debug it on the calling isolate. -
pixelRatioFor(
PdfPage page, {double target = 3, int maxSidePixels = 4000}) → double -
See OcrRunnerEngine.pixelRatioFor.
override