Expand description
Product-neutral two-stage ONNX OCR pipeline.
Two-model pipeline:
- Det model (
det.onnx) — DB detector; finds text bounding boxes in the image. - Rec model (
rec.onnx) — multilingual recognizer (50 languages + symbols + emoji, 18,708-char dict); reads text from each cropped box. The vocab length is read from the model output at runtime, so the dict is model-driven, not hardcoded.
The caller configures the dynamic runtime through rightkit-onnx, supplies
an absolute model directory, and supplies resolved artifact provenance.
Re-exports§
pub use worker::RunRecord;pub use worker::WorkerCommand;pub use worker::WorkerEvent;pub use worker::WorkerEvents;pub use worker::WorkerFailure;pub use worker::WorkerRun;
Modules§
- worker
- Isolated child-per-request native OCR worker (ViewRight
ocr_worker.rs).
Structs§
- Ocr
- A reusable OCR handle. The ONNX engine loads lazily on first need and is then kept warm.
- OcrArtifact
Manifest - OcrEngine
- A loaded, warm OCR engine.
- OcrLine
- One recognized line with its position on the image.
- OcrOptions
- OcrOutcome
- Newline-joined text and the backend that produced it (ScrapeRight’s
OcrOutcomeshape). - OcrRect
- A normalized rectangle: 0..1 of the source image, origin top-left.
- OcrResult
- Text + geometry + confidence + provenance.
- Onnx
Config - Verified ONNX model set used by the fallback /
Onnxpreference. - Verified
OcrArtifacts
Enums§
- Backend
Preference - Isolation
- Where native recognition runs.
- OcrBackend
- Which backend produced a result.
- OcrError
- OcrError
Kind - Typed classification of an OCR failure, so hosts key on a kind instead of message text.
- OcrProvenance
Constants§
- MACOS_
VISION_ UNAVAILABLE - Prefix for an Apple Vision request that could not be performed.
- MAX_
PIXELS - Largest image decoded, in pixels (enforced on the header, before any pixel buffer is allocated — a decompression-bomb guard).
- OCR_
UNSUPPORTED_ PLATFORM - Prefix for a platform with no native OCR backend at all (Linux builds).
- WINDOWS_
OCR_ UNAVAILABLE - Prefix for a Windows backend that cannot recognize at all (no language pack).
Traits§
- Model
Lease Hook - An app’s model-store lease/refs registration, held for an ONNX engine’s lifetime.
- Native
Health Hook - A host-maintained memory of the native backend’s health verdict (no cache lives in this crate).
Functions§
- canary_
png - Embedded known-text PNG for the separate-process health canary.
- decode_
encoded - Decode PNG/JPEG bytes to RGB with the
MAX_PIXELSguard. - is_
backend_ unavailable - Does this error mean the native backend is unusable on this machine (a capability verdict, and the only thing that arms the ONNX fallback), as opposed to a per-image failure that must stay visible?
- native_
backend - The native backend for this OS, if compiled in (
nativefeature) and supported. - ocr_
image_ with_ manifest