Tesela is a CPU inference engine written in Rust that runs ONNX models and a complete OCR pipeline (page decoding, text detection, recognition, line orientation and page unwarping) with no Python, ONNX Runtime or PaddlePaddle at run time. It is for anyone who needs fast document OCR on ordinary CPUs, with no GPU, and it is the optional fastest engine of LegereOCR . On a full OCR page it takes 0.294 s against 0.739 s for LegereOCR on ONNX Runtime (see Results , which also gives the memory of each run and what it measures).
Status: early public version (0.0.2). The Python extension is on PyPI ( pip install tesela ); the crates are not on crates.io yet, and the PyPI wheel contains only the Python module, not the tesela command-line tool. The CLI is not shipped as a prebuilt binary (no release asset exists), so build it from source as shown below ( cargo build --release -p cli ). Identifiers, code and error messages are in Spanish; this README and the other top-level documents are in English, with a Spanish version in README.es.md . Licensed under the Apache License 2.0 .
Needs Rust 1.89 or later and the OCR models (see Models ).
The same from Python (3.12 or later; use a virtual environment). Wheels for Windows x64 and Linux x64; elsewhere pip builds it with Rust ( Build shows how to build it from this repository):
Measured on a Ryzen 9 9900X (Zen 5), 96 GB, Windows, against ONNX Runtime 1.31 and OpenVINO 2026.4, all classes in the same run. The machine was not idle, so timings are indicative; the scripts record the background load of every cell. The ratio is Tesela's time divided by the rival's, as a geometric mean per model; below 1 means Tesela is faster .
OpenVINO is still faster on most models, most of all at 8 threads. It has 17 models instead of 18 because silero_vad does not run in OpenVINO. On the full OCR page, where the whole pipeline is specialised, Tesela is ahead (median seconds per page):
How they were measured:
Per model: 18 public ONNX models (sources, pinned versions and sha256 in herramientas/modelos_publicos.json ). One worker per call with a fixed CPU affinity (1 thread = one logical CPU; 8 threads = 8 physical cores, which needs a CPU with SMT and at least 16 logical CPUs). Each cell is the median of 3 rounds of N timed repetitions after warm-up, with the classes interleaved (A, B, A, B...) in the same time window. OpenVINO ran with the LATENCY hint and one stream; "both f32" pins its precision hint to f32 (by default it lowers to bf16 on Zen 5). The vision models use a synthetic image generated by the script.
Full page: latency is one page at a time on 8 threads, over 20 pages; throughput is 8 single-thread workers over 48 pages (4 x 2 threads for Paddle, which does not fit the memory cap otherwise), median over 5 rounds, with the peak resident memory of the process tree. The pages come from LegereOCR's ground-truth corpus, which is partly built from private documents: they cannot be published, so only the aggregates are.
Against LegereOCR's own README: it reports 0.427 s per page for Tesela and 0.719 s for ONNX Runtime. That is the same kind of 20-page sample, but taken through LegereOCR's Python pipeline ( LEGERE_MOTOR=pagina ), which adds its own preprocessing and result building around the engine, and in a separate run. The 0.294 s above is the tesela binary alone, so the two Tesela figures are not comparable with each other, and the ONNX Runtime row differs slightly (0.739 against 0.719) because it is another run.
Memory: the two READMEs measure different things and must not be compared. The "RAM at throughput" row above is the summed peak resident memory of 8 single-thread workers running the tesela binary (763 MB) or LegereOCR's Python pipeline (3180 MB with ONNX Runtime). LegereOCR's README gives the peak of one process in the latency run through its Python pipeline: 689 MB for Tesela and 522 MB for ONNX Runtime, so there Tesela uses more memory, not less. We make no general claim that Tesela needs less memory.
To reproduce the tables (Windows; Python 3.12 with numpy , onnx , onnxruntime , openvino , psutil and opencv-python ; build the binary first):
TESELA_EXE points to the binary (default target/release/tesela ); TESELA_PY_ORT and TESELA_PY_OV choose the interpreters that have onnxruntime and openvino . The scripts pin CPU affinity through the Windows API. The full-page script also needs a LegereOCR clone ( LEGERE_REPO ), its models and its ground-truth corpus, plus interpreters with openvino and paddlepaddle for the rival columns. Part of that corpus is built from private documents, so from outside only its synthetic pages can be built ( --solo-sinteticas in LegereOCR's construir_corpus.py ): the 20 and 48 pages will be others and the full-page figures will not match ours.
Loads ONNX models and compiles them to a plan with fused convolutions, MatMul, attention and elementwise chains.
Runs f32 and bf16 on AVX-512, with AVX2+FMA and scalar fallbacks chosen at startup.
Runs the OCR page natively: decoding, preprocessing, detection, recognition, line orientation and page unwarping (UVDoc).
Treats models, images and caches as hostile input, with limits on elements, memory and time per run.
Ships a Python extension that releases the GIL.
INT8 support is partial: the OCR recogniser has it, and 2 of the 43 models in the parity set are INT8 models the general executor does not run.
Requires Rust 1.89 or later (edition 2024). The models are not in this repository: put them in a folder and point TESELA_MODELOS at it. If it is unset, tests and tools look in modelos/ at the root of the workspace (git-ignored). Tests that need a model that is not there are skipped with a message.
cargo test --workspace also builds the tests of the Python extension ( crates/py ), which link against libpython: it needs Python 3.12 or later (on Linux, with its shared library). Without Python, add --exclude tesela_py .
Lower CARGO_BUILD_JOBS if the linker runs out of memory (the release profile uses LTO). The default instruction set is the best the CPU offers; force a lower one with TESELA_ISA=avx2 or TESELA_ISA=escalar .
Python extension (module tesela , Python 3.12 or later), inside a virtual environment:
The five files the OCR pipeline reads from TESELA_MODELOS (all Apache-2.0 models; each keeps its own licence):
The simplest way to get them, with verification of every hash, is the downloader of LegereOCR:
Those four keys are all Tesela reads on its own. LegereOCR itself ( LEGERE_MOTOR=pagina ) also needs the page-orientation model PP-LCNet_x1_0_doc_ori.onnx (key ori_pagina ); without it legere fails with ModelosFaltantesError . To cover both, run the downloader with no arguments (it fetches every default model, checks each hash and writes ./modelos ): python -m legereocr.motores.descarga .
The public models of the speed and parity tables come from herramientas/modelos_descargar.py .
These were measured on the maintainer's machine. Several checks need models and inputs that are not in the repository, so cargo test alone does not repeat all of them. Test counts are those of this source tree, on the machine of the Results section.
Contributing and security
See CONTRIBUTING.md , SECURITY.md and CODE_OF_CONDUCT.md . Third-party components are listed in NOTICE . Spanish version: README.es.md .
Created and maintained by Cristian Camilo Robledo Cuellar · soft-solutions.org · cristiancamilorobledo@gmail.com
Need fast CPU inference or OCR built into your product? I build custom software and do consulting: get in touch through the website or by email.
Apache-2.0, see LICENSE and NOTICE (patched third-party code in terceros/ keeps its own licenses).
