Multi-Lang-OCR
Synthetic document images with full layout ground truth, in nine languages across six scripts. Built to fine-tune OCR and document-understanding models on documents that are not English — and not only in Latin script.
Every page is composed from real corpus prose, rendered as HTML in headless Chromium, and exported with the bounding box, reading order and text of every block the browser actually laid out. The ground truth is read back off the rendered DOM, so it describes the pixels rather than the intent.
Languages
| Code | Language | Script | Tokenization | Text source |
|---|---|---|---|---|
ar |
Arabic | Arabic (RTL) | word | Shamela book pages |
fr |
French | Latin | word | Wikipedia 20231101.fr |
en |
English | Latin | word | Wikipedia 20231101.en |
es |
Spanish | Latin | word | Wikipedia 20231101.es |
de |
German | Latin | word | Wikipedia 20231101.de |
ru |
Russian | Cyrillic | word | Wikipedia 20231101.ru |
zh |
Chinese (Simplified) | Han | character | Wikipedia 20231101.zh |
ja |
Japanese | Kana + Han | character | Wikipedia 20231101.ja |
hi |
Hindi | Devanagari | word | Wikipedia 20231101.hi |
Per language: 29,997 original pages in 3 shards, plus 3 augmented variants of each in 9 more. Across all nine that is 269,973 originals and 1,079,892 images.
Loading
from datasets import load_dataset
# one language
ds = load_dataset("OCR-Data/Multi-Lang-OCR", "fr", split="train", streaming=True)
# originals only, no augmented variants
ds = load_dataset("OCR-Data/Multi-Lang-OCR", "originals", split="train", streaming=True)
# everything
ds = load_dataset("OCR-Data/Multi-Lang-OCR", "all", split="train", streaming=True)
sample = next(iter(ds))
image = sample["png"] # or "jpg" for an augmented variant
annotation = sample["json"]
Layout
data/<lang>_001.tar .. <lang>_003.tar originals, PNG + JSON
data_aug/<lang>_001_aug1.tar .. _003_aug3.tar variants, JPEG + JSON
Sample keys carry the language prefix (fr_0000000), so keys are unique
across the whole dataset and shards can be unpacked into one directory
without overwriting each other. An original and its three variants share a
stem: fr_0000000 → fr_0000000_01, _02, _03.
Annotation
{
"markdown": "...", // the page as markdown, in reading order
"blocks": [ // every laid-out block
{
"top_left_x": 40, "top_left_y": 80,
"bottom_right_x": 754, "bottom_right_y": 131,
"content": "...",
"type": "title", // title | text | table | image | header | footer
"reading_index": 1,
"confidence_scores": null
}
],
"tables": [ // one entry per table, as cleaned HTML
{
"id": "tbl-0.html",
"content": "<table><tbody><tr><td rowspan=\"2\">..</td>..</tr></tbody></table>",
"format": "html",
"word_confidence_scores": [ ... ]
}
],
"images": [ { "id": "img-0", "top_left_x": .., "reading_index": .. } ],
"header": "...", "footer": "...",
"dimensions": { "width": 824, "height": 1090, "dpi": 96 },
"confidence_scores": { "word_confidence_scores": [ ... ] },
"meta": {
"template": "a4_paper",
"language": "fr", "script": "latin", "direction": "ltr",
"page_font": "NotoSerif-Regular.ttf",
"title_font": "Montserrat[wght].ttf",
"hybrid": null,
"augmentation": null // or { "name": "rotation", "params": {...} }
}
}
Tables and merged cells
Roughly one table in five carries merged cells — rowspan, colspan, or
both. Spans are placed on an occupancy grid, so every table expands to a
complete rectangular grid with no cell claimed twice and no hole left
unclaimed, and no span ever reaches past the last row. Merged cells carry text
like any other cell.
This matters because merged cells are where table-recognition models fail, and because synthetic table data that only ever shows uniform grids teaches a model that merges do not exist.
What the pages look like
14 page templates: A4 reports, academic papers with LaTeX equations and theorem boxes, dedicated table pages, chart pages, image galleries, literary pages with verse, invoices, formal letters, receipts, book covers, business cards, ID cards and minimalist layouts. A page may also carry a small out-of-place "hybrid" block (7% of pages), which is deliberate: real documents are not homogeneous.
Text direction, alignment and boilerplate follow the language. Arabic pages are genuinely right-to-left, not Latin layout with Arabic glyphs dropped in.
Augmentations
Three variants per original, each a different transform drawn without
replacement from: gaussian blur, bad photocopy, bleed-through, colour shift,
letterpress, rotation (±5°, bounding boxes rewritten), reflected light, shadow
cast, watermark, gaussian noise. meta.augmentation records which one and with
what parameters. Watermark text is drawn in the page's own language, in a face
verified to cover it.
Variants are JPEG (quality 90); originals are lossless PNG.
Fonts
Each language draws from faces verified against that language's script by
reading the font's own cmap, not from a hand-maintained list. Complex
scripts additionally require the right OpenType shaping tables — a font with
Arabic codepoints but no arab GSUB renders unjoined letterforms that look
like text and are not, and is excluded.
Corpus characters a page's font cannot render are dropped before the text is placed, so the annotation never claims a character the image does not show.
No font file is redistributed in this dataset — only rendered images.
Caveats
- Synthetic. The layouts are real layouts and the prose is real prose, but no page is a photograph of a real document. Use it to teach layout and script, and validate on real scans.
- Not deduplicated against anything else, including
OCR-Data/ocr_data. - Not reproducible. Generation is not seeded; re-running produces a different dataset.
- Hindi repeats source text more than the others.
hi.wikipediahas about 163,000 articles against 29,997 samples, so the pool is shallower than English's. - Confidence scores are synthetic — always 1.0. They exist so the schema matches real OCR output, not because anything was measured.
Licence
Images and annotations: CC-BY-4.0. Source text derives from Wikipedia (CC-BY-SA-3.0) and public-domain book scans; text reproduced in the images carries its original licence.
- Downloads last month
- 115