Skip to main content

Crate sceptre

Crate sceptre 

Source
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:

  1. Detection ([detect]) — CRAFT produces region/link heat-maps that are post-processed into text boxes.
  2. Recognition ([recognize]) — each box is cropped, normalized, and run through a gen2 CRNN; the logits are CTC-decoded into text.
  3. Inference backend ([inference]) — a runtime-neutral [inference::ModelBackend] seam abstracts over ort (native) and tract (pure-Rust), with candle reserved 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].
ConcurrencyConfig
Caps the worker and inference thread pools within each reader.
DetectionConfig
Parameters controlling CRAFT detection and box grouping.
FallbackEngine
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.
ModelConfig
Model selection and provisioning configuration.
ModelDescriptor
Filesystem-free registry metadata for one model artifact.
ModelInfo
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.
ReadOptions
Per-call options for a Reader::readtext or Reader::recognize invocation.
Reader
A ready-to-use OCR reader.
ReaderBuilder
Builder for Reader, filling injectable seams with in-crate defaults.
RecognitionConfig
Parameters controlling recognition and decoding.
TextLine
A single recognized line of text with its location and confidence.
VerifiedModelProvider
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).
ModelArtifact
A model artifact resolved either as a local path or in-memory bytes.
ModelRole
The role a model plays in the pipeline.
OcrError
The single error type for all sceptre operations.

Constants§

VERSION
The sceptre crate version.

Traits§

ModelProvider
Resolves detector and recognizer model artifacts.
OcrEngine
The primary extension seam: an OCR engine turns an image into recognized text.
ProgressSink
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 the download feature; without it the underlying fetch returns an crate::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.