Skip to main content

Crate rlx_ocr

Crate rlx_ocr 

Source
Expand description

OCR engine for RLX — native compiled detection + recognition graphs.

Load HuggingFace robertknight/ocrs weights as .safetensors (use rlx-ocr-convert with feature convert-rten to export from legacy .rten).

Detection + recognition run on every standard RLX backend when the matching rlx-runtime feature is enabled (cpu, metal, mlx, cuda, rocm, gpu, vulkan). Build with all-backends for a single binary that accepts all --device values.

Parity / baseline: parity-ocrs (upstream ocrs + RTen) or rten-inference (RTen graphs only).

Re-exports§

pub use capabilities::validate_device;
pub use config::DEFAULT_ALPHABET;
pub use config::DecodeMethod;
pub use config::DetectionParams;
pub use config::OcrConfig;
pub use ctc::CtcHypothesis;
pub use ctc::CtcStep;
pub use ctc::decode;
pub use engine::OcrEngine;
pub use engine::OcrEngineParams;
pub use engine::OcrInput;
pub use engine::input_image;
pub use engine::ocr_rgb_bytes;
pub use preprocess::BLACK_VALUE;
pub use preprocess::DimOrder;
pub use preprocess::ImageSource;
pub use preprocess::ImageSourceError;
pub use preprocess::prepare_image;
pub use runner::OcrOutput;
pub use runner::OcrRunner;
pub use runner::OcrRunnerBuilder;
pub use text::TextChar;
pub use text::TextItem;
pub use text::TextLine;
pub use text::TextWord;
pub use weights::HF_DETECTION_RTEN;
pub use weights::HF_DETECTION_ST;
pub use weights::HF_DETECTION_ST_FULL;
pub use weights::HF_RECOGNITION_RTEN;
pub use weights::HF_RECOGNITION_ST;
pub use weights::HF_RECOGNITION_ST_FULL;
pub use weights::SafetensorsFile;
pub use weights::is_rten_checkpoint;
pub use weights::load_rlx_weights;
pub use weights::load_safetensors;
pub use weights::load_safetensors_weights;
pub use weights::resolve_model_dir;
pub use model::DetectionGraphConfig;
pub use model::RecognitionGraphConfig;
pub use rlx::RlxTextDetector;
pub use rlx::RlxTextRecognizer;

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§

RotatedRect
An oriented rectangle.

Constants§

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.