Expand description
§sceptre
A Rust reimplementation of EasyOCR’s OCR pipeline — CRAFT text detection followed by gen2 CRNN recognition with CTC decoding — running the models over ONNX.
§Architecture
The pipeline is three stages behind a single Reader handle:
- Detection ([
detect]) — CRAFT produces region/link heat-maps that are post-processed into text boxes. - Recognition ([
recognize]) — each box is cropped, normalized, and run through a gen2 CRNN; the logits are CTC-decoded into text. - Inference backend ([
inference]) — a runtime-neutral [inference::ModelBackend] seam abstracts overort(native) andtract(pure-Rust), withcandlereserved as a deferred pure-Rust fallback.
Models are resolved and cached by [models]; behavior is configured through
[config].
Structs§
- BBox
- An axis-aligned bounding box
[x_min, y_min, x_max, y_max]. - Concurrency
Config - Caps the worker and inference thread pools within each reader.
- Detection
Config - Parameters controlling CRAFT detection and box grouping.
- Fallback
Engine - Composes engines, trying each in order until one returns a non-empty result.
- Image
- A decoded, owned RGB8 image — the public input DTO for the OCR engine.
- Model
Config - Model selection and provisioning configuration.
- Model
Descriptor - Filesystem-free registry metadata for one model artifact.
- Model
Info - A model required by a configuration, with its resolved repo id and cache status.
- OcrConfig
- Top-level OCR configuration.
- OcrResult
- The full result of an OCR run over one image.
- Point
- A 2D point in pixel coordinates.
- Quad
- A four-point quadrilateral (clockwise from top-left), used for rotated text.
- Read
Options - Per-call options for a
Reader::readtextorReader::recognizeinvocation. - Reader
- A ready-to-use OCR reader.
- Reader
Builder - Builder for
Reader, filling injectable seams with in-crate defaults. - Recognition
Config - Parameters controlling recognition and decoding.
- Text
Line - A single recognized line of text with its location and confidence.
- Verified
Model Provider - An in-memory provider that verifies every artifact before exposing it.
Enums§
- Backend
- Which inference backend to use.
- Decoder
- CTC decoding strategy.
- Language
- A supported recognition language group (gen2 models only).
- Model
Artifact - A model artifact resolved either as a local path or in-memory bytes.
- Model
Role - The role a model plays in the pipeline.
- OcrError
- The single error type for all sceptre operations.
Constants§
- VERSION
- The sceptre crate version.
Traits§
- Model
Provider - Resolves detector and recognizer model artifacts.
- OcrEngine
- The primary extension seam: an OCR engine turns an image into recognized text.
- Progress
Sink - Receives coarse progress notifications from the pipeline.
Functions§
- download_
models - Ensure every model in
config’s manifest is present locally, downloading any that are missing, and return the resulting (now-cached) manifest. Requires thedownloadfeature; without it the underlying fetch returns ancrate::OcrError::Model. - model_
descriptors - Describe the detector and each distinct configured recognizer without filesystem or network access.
- model_
manifest - The models required by
config: the CRAFT detector plus one recognizer per configured language (in order, duplicates preserved), each annotated with cache status. Pure filesystem inspection — no network.
Type Aliases§
- Result
- Standard result type for all fallible operations in sceptre.