Nomeda OCR (tiny)

Tiny multilingual OCR with table structure extraction. Arabic-first (RTL), printed + handwritten, plus Latin, lines + tables, JSON / Markdown / CSV out. 7.28M parameters total (line/cell detector 2.45M + line reader 4.82M), runs on CPU.

Use

from huggingface_hub import snapshot_download
import sys; d = snapshot_download("nomeda-lab/nomeda-ocr"); sys.path.insert(0, d)
from nomeda_ocr.pipeline import TinyOCR
ocr = TinyOCR(d + "/detector", d + "/reader")
res = ocr.read("page.png")            # dict: lines, tables, text
print(ocr.to_markdown(res))            # free text + tables as Markdown, in reading order
ocr.to_json(res, "page.json"); ocr.tables_csv(res, "tables/")

Needs: torch pillow numpy python-bidi huggingface_hub.

Output

{"page": {"width": 1200, "height": 900},
 "lines": [{"id": 0, "text": "...", "box": [x0,y0,x1,y1], "conf": 0.97, "dir": "rtl", "table": null}],
 "tables": [{"id": 0, "box": [..], "n_rows": 6, "n_cols": 4, "rtl": true,
   "cells": [{"row": 0, "col": 0, "rowspan": 1, "colspan": 2, "bbox": [..], "text": "...", "conf": 0.95}],
   "markdown": "| ... |"}],
 "text": "free text outside tables, reading order"}

For right-to-left tables col 0 is the first logical column (right-most on the page); text is in logical order.

How it works

  1. CenterNet-style detector finds text lines and table cells (tiled multi-scale, any page size).
  2. CRNN+CTC reader reads each line (Arabic script incl. Persian/Urdu letters, Latin with accents, Arabic-Indic digits, currency symbols); bidi order is restored.
  3. Rule-based layout step turns cell boxes into rows / columns / spans, assigns lines to cells, and fixes RTL reading order.

Training data

Synthetic pages (30+ real fonts, tables, scans, pen-style handwriting) mixed with real data from the Hugging Face Hub:

  • aamijar/muharaf-public (licence: cc-by-nc-sa-4.0)
  • johnlockejrr/KHATT_v1.0_dataset (licence: mit (original KHATT terms: research use))
  • mohajesmaeili/Persian_Arabic_TextLine_Image_Ocr_Medium (licence: unspecified)
  • docling-project/PubTables-1M_OTSL-v1.1 (licence: other (PubTables-1M: CDLA-Permissive-2.0))

Limits (honest)

Handwriting: real data is Arabic (manuscripts + KHATT lines); Latin handwriting is synthetic only, so expect it to be weaker. Page-level handwriting line detection is trained mostly on synthetic notes. Printed text only otherwise; no vertical text, no CJK/Cyrillic. Real tables in training are English scientific tables (PubTables-1M); Arabic table layouts come from synthetic data. Tables are found from detected cell rectangles, so heavily skewed photos, curved pages and faint borderless tables are the weak spots. Evaluation numbers: see eval.json.

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