Datasets:
Download README.md from OCR-Data/ocr_eval: direct link, hf CLI and curl.
- Browser
- Download file 5.05 kB
-
https://huggingface.co/datasets/OCR-Data/ocr_eval/resolve/main/README.md
- Command line
-
hf download hf://datasets/OCR-Data/ocr_eval/README.md
-
curl -L -o README.md https://huggingface.co/datasets/OCR-Data/ocr_eval/resolve/main/README.md
pretty_name: OCR Eval (Arabic synthetic documents)
task_categories:
- image-to-text
language:
- ar
tags:
- ocr
- arabic
- synthetic
- webdataset
- eval
configs:
- config_name: original
data_files:
- split: test
path: data/*.tar
- config_name: augmented
data_files:
- split: test
path: data_aug/*.tar
OCR Eval
A small, fixed evaluation set of synthetic Arabic document images with layout annotations — the held-out companion to OCR-Data/ocr_data.
Do not train on this. It exists so OCR models trained on ocr_data can be scored on
unseen pages from the same generator.
| Originals | 1500 (lossless PNG + JSON) |
| Augmented | 1500 — exactly one variant per original (lossless PNG + JSON) |
| Shards | 2 (data/shard_001.tar, data_aug/shard_001_aug1.tar) |
| Templates | the same 14 document genres as ocr_data |
| Augmentations | the same 10 transforms as ocr_data, same weighting |
| Language | Arabic (RTL) |
Loading
from datasets import load_dataset
clean = load_dataset("OCR-Data/ocr_eval", "original", split="test")
noisy = load_dataset("OCR-Data/ocr_eval", "augmented", split="test")
Both configs are WebDataset shards: files sharing a basename are one sample, so the image
arrives as the image column and the annotation as json.
Pairing originals with their variants
A variant's key is its original's key plus a two-digit slot:
sample_0000042 -> data/shard_001.tar
sample_0000042_01 -> data_aug/shard_001_aug1.tar
The shared stem is the only linkage — there is no field inside the annotation pointing
back at the original. Strip the _NN suffix to join the two configs:
original_key = variant_key.rsplit("_", 1)[0]
Text is unique per image
This is the one place the eval set deliberately departs from how ocr_data was generated,
and the reason it can be used for independent measurements.
In the training set, workers share a pool of 3000 consecutive corpus pages and draw from it at random, so the same page renders into many images. Here, every image is given its own private set of 10 corpus pages that no other image may use, drawn from a shuffled read across the whole 4.6M-page source corpus rather than one contiguous window. A document consumes several pages (a page runs out and the next is pulled), so the guarantee is enforced over the whole set a page may come from, not over a single page.
meta.corpus_pages lists the pages each document actually consumed, as truncated SHA-1
digests of the page text, so the property is checkable rather than merely claimed:
pages = [p for r in clean for p in r["json"]["meta"]["corpus_pages"]]
assert len(pages) == len(set(pages)) # no corpus page used by two images
Annotation schema
{
"markdown": "...",
"dimensions": {"dpi": 96, "width": 0, "height": 0},
"blocks": [{"type": "title|text|table|image|header|footer",
"content": "...", "reading_index": 0,
"top_left_x": 0, "top_left_y": 0,
"bottom_right_x": 0, "bottom_right_y": 0}],
"images": [{"top_left_x": 0, "...": 0}],
"tables": [],
"header": null,
"footer": null,
"meta": {"template": "a4_report", "hybrid": null,
"page_font": "...", "title_font": "...",
"language": "ar", "script": "arabic", "direction": "rtl",
"corpus_pages": ["a1b2c3d4e5f6", "..."],
"augmentation": null}
}
meta.augmentation is null throughout the original config and
{"name": ..., "params": {...}} throughout augmented. Coordinates are pixels in the
image's own space; rotation is the only augmentation that changes dimensions, and its
boxes are transformed to match.
Augmentation counts are the training weighting applied to 1500 draws — roughly 160 samples
for each of gaussian_blur, bad_photocopy, bleed_through, color_shift, letterpress,
rotation, reflected_light, shadow_cast, gaussian_noise, and ~37 watermark. Group
by meta.augmentation.name to report per-transform robustness.
Caveats
- Not deduplicated against the training set. Corpus text is unique per image and scattered across the whole source corpus, but the generator does no content hashing, so an eval layout can coincidentally resemble a training layout. This is a synthetic in-distribution eval, not a contamination-proof benchmark.
- Not reproducible. The generator does not seed its RNG, so this exact set of 1500
cannot be regenerated. These shards are the only copy of the ground truth. Each variant's
parameters are recorded in
meta.augmentation.paramsand each page's text provenance inmeta.corpus_pages. - Ground truth is synthetic, not human-annotated: boxes and reading order come from the renderer's own DOM, so they are exact by construction rather than by agreement.
To get loose files back out of a shard, use unpack_shard.py from the generator repo.