Skip to main content

Module ocr

Module ocr 

Source

Modules§

capabilities
Backend capability checks for OCR graphs.
cli
config
OCR configuration — detection thresholds, alphabet, decode method.
ctc
CTC decoding (greedy + beam search).
detection
engine
High-level OCR engine — detect, layout, recognize.
geom
Geometry helpers for line polygons and edge extraction.
layout
Layout analysis — group detected words into reading-order lines (upstream ocrs algorithm).
model
Native RLX graphs for ocrs detection (U-Net) and recognition (CRNN + GRU).
preprocess
Greyscale image preprocessing for OCR models.
recognition
Recognition module — line batching helpers and full CRNN/GRU inference.
rlx
Compiled RLX inference for ocrs detection and recognition.
runner
High-level OCR runner with image loading.
text
Recognized text items with character-level bounding boxes.
weights
Weight paths, safetensors load, and optional .rten export.

Structs§

CtcHypothesis
Decoded label sequence with log score.
CtcStep
Item in a decoded sequence.
DetectionGraphConfig
DetectionParams
Post-processing parameters for the text detection segmentation mask.
ImageSource
Input image for crate::OcrEngine::prepare_input.
OcrConfig
Shared OCR settings.
OcrEngine
End-to-end OCR pipeline (ocrs-compatible API).
OcrEngineParams
Parameters for constructing an OcrEngine.
OcrInput
Preprocessed greyscale input image [1, H, W].
OcrOutput
Structured OCR output.
OcrRunner
OCR session wrapping a fully loaded OcrEngine.
OcrRunnerBuilder
Builder for OcrRunner (mirrors whisper / dinov2 runners).
RecognitionGraphConfig
RlxTextDetector
Text detector using a compiled native RLX U-Net graph.
RlxTextRecognizer
Recognition backend using compiled native RLX CRNN + GRU graphs (per padded width).
RotatedRect
An oriented rectangle.
SafetensorsFile
Mmap-backed safetensors file; reuse across per-width graph builds.
TextChar
A single recognized character with its axis-aligned bounding box.
TextLine
A line of text composed of words.
TextWord
A word composed of one or more characters.

Enums§

DecodeMethod
Method used to decode CRNN sequence outputs.
DimOrder
Pixel layout for image tensors.
ImageSourceError
Errors when constructing an ImageSource.
TextItem
Any recognized text item (line, word, or character).

Constants§

BLACK_VALUE
Normalized greyscale background value used by ocrs models (matches ocrs 0.12.x).
DEFAULT_ALPHABET
Default character alphabet matching ocrs pretrained recognition models.
HF_DETECTION_RTEN
Production detection checkpoint (legacy RTen graph).
HF_DETECTION_ST
Safetensors export of detection weights (short name).
HF_DETECTION_ST_FULL
Full detection export (includes int32 BN scalars from RTen).
HF_RECOGNITION_RTEN
Production recognition checkpoint (legacy RTen CRNN + GRU graph).
HF_RECOGNITION_ST
Safetensors export of recognition weights.
HF_RECOGNITION_ST_FULL
STANDARD_DEVICES
Backends every model crate is expected to support when the matching rlx-runtime feature is enabled at build time.
STANDARD_DEVICE_NAMES
CLI / help string for --device.

Functions§

decode
Decode a [seq, classes] log-probability matrix.
input_image
is_rten_checkpoint
True when path is an ocrs .rten checkpoint.
load_rlx_weights
Alias for load_safetensors_weights.
load_safetensors
Load a .safetensors file via mmap-backed read into f32 WeightMap tensors.
load_safetensors_weights
Load weights for RLX graph build (safetensors only).
ocr_rgb_bytes
prepare_image
Convert an image to a normalized greyscale CHW tensor [1, H, W].
resolve_model_dir
Resolve detection + recognition weight paths under dir (safetensors for native RLX).
validate_device
Validate that device is in the workspace standard backend set.