SquiddleOCR recognisers

ONNX conversions of kraken's PP-OCRv6 text-line recognisers by Benjamin Kiessling (ALMAnaCH, Inria Paris), packaged by SquiddleOCR 0.2.0. The models read printed and handwritten text lines in 44 languages and 10 scripts (Arabic, Armenian, Cyrillic, Ethiopic, Georgian, Greek, Hebrew, Latin, Malayalam, Syriac), historical and modern, and transcribe them diplomatically: long s, ligatures, combining diacritics and historical orthography are kept.

Nothing is retrained. Each model directory contains the weights as inference.onnx, the PaddleOCR-style inference.yml and dict.txt, the original kraken model card (MODEL_CARD.md, with training data credits), a NOTICE with author, licence and Zenodo DOI, the Apache-2.0 LICENSE, and squiddle.json recording the source file hash, tool versions and the ONNX-vs-PyTorch parity check of the conversion.

model parameters size kraken test CER (macro) directory source
PP-OCRv6 tiny 0.7M 3 MB 8.7 % (11.0 %) models/squiddle_PP-OCRv6_tiny_rec kraken, DOI 10.5281/zenodo.21788403
PP-OCRv6 small 3.2M 14 MB 5.4 % (6.9 %) models/squiddle_PP-OCRv6_small_rec kraken, DOI 10.5281/zenodo.21788405
PP-OCRv6 medium 15.8M 64 MB 3.9 % (4.9 %) models/squiddle_PP-OCRv6_medium_rec kraken, DOI 10.5281/zenodo.21788410

CER figures are kraken's own evaluation on its held-out test set, from the model cards.

Use with SquiddleOCR

pip install "squiddleocr[paddle]"
squiddle ocr scans/                    # medium recogniser from this repo, layout analysis, tables; DocLang + Markdown
squiddle ocr scans/ -m small           # a smaller size
squiddle ocr scans/ --models storytracer/squiddleocr    # this repo explicitly (it is the default)

SquiddleOCR combines these recognisers with layout, text detection and table models and writes DoclingDocuments (DocLang, Markdown, HTML, JSON). Sizes are downloaded into ~/.cache/squiddleocr/ on first use.

Use with PaddleOCR / PP-StructureV3

Each directory is a drop-in text recognition model for PaddleOCR 3.x. Download it (for example with squiddle models pull medium, or huggingface_hub.snapshot_download("storytracer/squiddleocr", allow_patterns=["models/squiddle_PP-OCRv6_medium_rec/*"])) and pass it with its registered name and the ONNX Runtime engine:

from paddleocr import PPStructureV3
pipe = PPStructureV3(text_recognition_model_dir="models/squiddle_PP-OCRv6_medium_rec",
                     text_recognition_model_name="PP-OCRv6_medium_rec", engine="onnxruntime")

What the conversion does

kraken feeds its network 96 px lines scaled to 0..1 and inverted, with 16 px of white padding at both ends, and batches lines with white padding plus an attention mask. The ONNX graph takes PaddleOCR's [-1, 1] input and folds all of that in (inversion, padding, detection and masking of batch padding, blank forcing on padded time steps), emitting (batch, time, classes) softmax probabilities with the CTC blank at index 0. Verified line for line against kraken on real line strips (see the SquiddleOCR repository, squiddle verify).

Input contract

RGB line images of any width, resized to 96 px height, normalised (x/255 - 0.5) / 0.5; batches right-padded with zeros. Output: (batch, time, 1623) probabilities, dict.txt entry i is class i + 1, class 0 is the blank; time steps correspond to 8 input pixels each.

Licence and citation

The weights are Apache-2.0, © Benjamin Kiessling, trained with support of the ATRIUM and MiDRASH projects; see MODEL_CARD.md in each directory for the training data and their licences. Please cite kraken and the Zenodo DOI of the model you use. The squiddle_ naming identifies the packager and is not the author's.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for storytracer/squiddleocr

Quantized
(1)
this model