Skip to main content

Tesela

Fast document OCR and ONNX inference on ordinary CPUs, written in Rust.

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 ONNX Runtime or PaddlePaddle at run time. This package is its Python extension: the module tesela. It is also 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, measured on a Ryzen 9 9900X; the Results section of the repository gives every measurement, its memory and what it measures.

Status: first public version (0.0.1). Error messages and identifiers are in Spanish.

Install

pip install tesela

Wheels for Python 3.12 or later on Windows x64 and Linux x64 (glibc). On other platforms pip tries to build it from the source distribution, which needs a recent stable Rust toolchain; only Windows x64 and Linux x64 are tested. The instruction set is chosen when it runs (AVX-512, AVX2+FMA or scalar); force a lower one with TESELA_ISA=avx2 or TESELA_ISA=escalar.

With LegereOCR

pip install legereocr tesela
$env:LEGERE_MOTOR = "pagina"      # then run LegereOCR as usual
legere ocr page.png --json out.json

LEGERE_MOTOR=auto (the default) never loads Tesela: it is opt-in.

On its own

It reads the OCR models from a folder (see Models; the downloader of LegereOCR fetches them and checks every hash: python -m legereocr.motores.descarga det_v6_tiny rec_latin ori_linea uvdoc).

import cv2, tesela

page = tesela.Pagina("modelos", hilos=8)   # folder with the OCR models
result = page.ocr(cv2.imread("page.png"))  # BGR uint8 array, H x W x 3
for text, confidence in zip(result["textos"], result["confianzas"]):
    print(f"{confidence:.2f}  {text}")

opencv-python is only for reading the image in this example; any BGR uint8 array works.

More

The repository has the full README, the command-line tool, the build from source and the measurements: github.com/tesela-engine/tesela. Licensed under the Apache License 2.0; each OCR model keeps its own licence. The package carries NOTICE and THIRD-PARTY-LICENSES.txt with the code and crates it includes.

Metadata

Release files for tesela 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tesela 0.0.1
File Size Uploaded Provenance Actions
tesela-0.0.1.tar.gz 1.4 MB Without provenance Details for tesela-0.0.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for tesela 0.0.1
File Interpreter ABI Platform Actions
tesela-0.0.1-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for tesela-0.0.1-cp312-abi3-win_amd64.whl
tesela-0.0.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for tesela-0.0.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Total release size: 6.5 MB

Release files / tesela-0.0.1.tar.gz

Download URL tesela-0.0.1.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
597ae25a44b84fd58da3bf9db4c66ba3307b1ba592e118071a8bba740f74ce5d
BLAKE2b-256 checksum
How to use checksums
f12037de27268bffb6cc6b54f890882bca58d709f7c2aa112a063a8a81459ee5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / tesela-0.0.1-cp312-abi3-win_amd64.whl

Download URL tesela-0.0.1-cp312-abi3-win_amd64.whl
Size 2.6 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
43b1fffd24e9a429f0b8bac6070ff1d4894a398598ce2260d4f50d3484e9c3a7
BLAKE2b-256 checksum
How to use checksums
b1e1433c31833ad3ea97a7ff8322200c7cda8e20e91f45fb904fc1ebeb8b970d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / tesela-0.0.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL tesela-0.0.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 2.5 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
f22a89799e3e745f951f16bcd4293f68f41b4b0d8c6eac8d276510e923e53bdd
BLAKE2b-256 checksum
How to use checksums
c2a1d1faded5dea89eef174d705bb5fa31aa6f9f058e6e6994bd614fa0d0f74a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Security for tesela 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

3 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page