Datasets:
component string | n_train int64 | n_val int64 | numeric_frac float64 | n_wiki int64 | n_numeric int64 | render_engine string | label_order string | numeric_digits string | legal_templates bool | seed int64 | aug_frac float64 | max_text_length int64 | min_text_length int64 | char_dict string | fonts list | wiki_oov_dropped int64 | numeric_oov_dropped int64 | bidi_dropped int64 | normalization string | text_sources dict | label_contract string | decode_limitation string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
synthetic_workhorse | 500,000 | 2,000 | 0.15 | 426,700 | 75,300 | raqm | visual | western | false | 0 | 0.5 | 25 | 4 | ppocrv5_arabic_dict.txt | [
"Amiri-Regular.ttf",
"ScheherazadeNew-Regular.ttf",
"NotoNaskhArabic.ttf",
"Lateef-Regular.ttf",
"ReemKufi.ttf",
"NotoKufiArabic.ttf",
"ArefRuqaa-Regular.ttf",
"Cairo.ttf",
"Tajawal-Regular.ttf",
"Almarai-Regular.ttf",
"ElMessiri.ttf",
"Changa.ttf",
"IBMPlexSansArabic-Regular.ttf",
"Markaz... | 531 | 0 | 0 | NFKC + strip-tashkeel-v1 + drop-tatweel; digit classes kept distinct | {
"broad_arabic": {
"dataset": "wikimedia/wikipedia",
"config": "20231101.ar",
"license": "CC-BY-SA 4.0",
"attribution": "Arabic Wikipedia (wikimedia/wikipedia 20231101.ar), CC BY-SA 4.0"
},
"numeric": {
"type": "generated general numerics/dates/measures/percent/ranges"
}
} | visual_label=get_display(logical, base_dir=R) base forms; image=raqm(logical, rtl) OR get_display(reshape(logical), base_dir=R); gt_logical=logical. | pred_reverse mirrors multi-digit AI/Extended-AI numbers + Latin runs (LTR class excludes U+0660-0669 & U+06F0-06F9); lines flagged decode_mirror in gt_logical. |
Arabic Printed OCR Lines — Synthetic, 500k
A general-purpose printed Arabic text-line recognition corpus: 500,000 train + 2,000 val line images with labels, built to fine-tune line-recognition models (PaddleOCR PP-OCR rec CTC/MultiHead, TrOCR, etc.). Real line-crop printed-Arabic data does not exist at this scale on the Hub, so this corpus is rendered synthetically with diverse fonts + real Arabic text and a documented label/decoding contract.
Why this exists
Public "Arabic OCR" line datasets are scarce, narrow, or mislabeled: the largest "real" one is itself synthetic with a fixed height and no digits/punctuation/diacritics, and Persian-mixed sets are ~half Persian after naive filtering. This corpus targets a full Arabic charset (letters + Western digits + punctuation), 15 typeface families, and realistic scan degradations, so a model trained on it generalizes to real printed Arabic.
Contents (inside arabic_ocr_printed_v1.tar)
images/ # 502,000 line JPEGs (train_*.jpg, val_*.jpg)
train_list.txt # "images/<f>.jpg\t<visual_label>" (500,000 lines)
val_list.txt # same format (2,000 lines)
gt_logical.jsonl # {"path","logical_gt","decode_mirror"} per image
manifest.json # full generation config + counts
samples/ # a few rendered samples + a round-trip table
manifest.json is also provided unpacked at the repo root for quick inspection.
Label contract (read before training) — IMPORTANT
Arabic is RTL; CTC alignment is monotonic with image columns (left→right). So labels are stored in VISUAL order, and a logical sidecar is kept for scoring:
logical_gt— the natural typed string (base Unicode). Score against this.visual_label—python_bidi.get_display(logical_gt, base_dir="R")(base forms, visual order). This is what's intrain_list.txt/val_list.txtand what the model learns to emit.- image — rendered in the same visual order as the label (libraqm/RAQM shapes & reorders
from base logical text with
direction="rtl"; HarfBuzz, so any font works, no presentation-form gate).
At inference, a decoder that restores logical order (e.g. PaddleOCR CTCLabelDecode with an
Arabic dict, which applies pred_reverse) converts the model's visual output back to logical.
Empirically (overfit order-test): visual-order labels give CER 0.011 vs 0.88 for
logical-order labels (the logical arm comes out mirror-reversed — the CTC-monotonic signature).
Known decode limitation — decode_mirror
PaddleOCR's pred_reverse LTR class excludes Arabic-Indic (U+0660–0669) and Extended/Persian
(U+06F0–06F9) digits and reverses LTR runs group-wise, so multi-digit numbers adjacent to
Arabic can mirror at decode. This corpus uses Western digits (round-trip cleanly + match
Maghreb/Tunisian print). Lines whose round-trip is affected are flagged decode_mirror: true
in gt_logical.jsonl — report CER with and without those lines.
Generation
- Text: ~85% Arabic Wikipedia (
wikimedia/wikipedia,20231101.ar, CC-BY-SA 4.0) + ~15% generated general numerics/dates/measures/percent/ranges. Lengths 4–25 chars. - Normalization: NFKC + strip-tashkeel + drop-tatweel; digit classes kept distinct. Bidi control/format chars (U+200E/200F/061C/202A–202E/2066–2069) stripped before layout (ZWNJ/ZWJ kept). OOV chars (vs the PP-OCRv5 Arabic dict, ~1050 chars) gated out.
- Fonts (15, OFL): Amiri, Scheherazade New, Noto Naskh/Kufi Arabic, Lateef, Reem Kufi, Aref Ruqaa, Cairo, Tajawal, Almarai, El Messiri, Changa, IBM Plex Sans Arabic, Markazi Text, Harmattan — Naskh / Kufi / Ruqaa / modern-sans coverage. Random size 30–44, dark-gray ink, variable padding & line height.
- Augmentation (≈50% of images, real-scan): Gaussian blur, Gaussian + salt-and-pepper noise, brightness drop, JPEG recompression (q35–70), ±3° rotation.
- Render engine: libraqm/RAQM (HarfBuzz shaping from base text).
See manifest.json for exact counts (incl. wiki_oov_dropped, bidi_dropped).
Quick start
import tarfile
tarfile.open("arabic_ocr_printed_v1.tar").extractall("corpus")
# corpus/images/, corpus/train_list.txt (path<TAB>visual_label), corpus/gt_logical.jsonl
For PaddleOCR rec: point Train.dataset.data_dir=corpus,
Train.dataset.label_file_list=[corpus/train_list.txt], use an Arabic char dict
(dict filename containing "arabic" so decode applies pred_reverse).
Limitations & roadmap
- Backgrounds are clean/near-white (real scans have paper texture/color) — a v2 augmentation gap.
- No handwritten text (separate, harder track).
- Eastern/Arabic-Indic digit support is decode-limited (see
decode_mirror); Western digits recommended.
License & attribution
CC-BY-SA 4.0 (inherited from Arabic Wikipedia source text). Attribution: Arabic Wikipedia (wikimedia/wikipedia 20231101.ar), CC BY-SA 4.0. Fonts are SIL OFL (cover the font files, not rendered output). Generated numeric lines are unencumbered.
- Downloads last month
- 56