| --- |
| license: cc-by-4.0 |
| task_categories: |
| - image-to-text |
| language: |
| - ar |
| - fr |
| - en |
| tags: |
| - ocr |
| - arabic |
| - handwriting |
| - invoices |
| - document-understanding |
| size_categories: |
| - 10K<n<100K |
| pretty_name: Alhazen-OCR Data |
| configs: |
| - config_name: default |
| data_files: |
| - split: train |
| path: data/train-* |
| - split: eval |
| path: data/eval-* |
| --- |
| |
| # Alhazen-OCR Data |
|
|
| `alhazen-ocr` is the training dataset behind |
| [`context212/alhazen-ocr`](https://huggingface.co/context212/alhazen-ocr), an |
| Arabic-first OCR vision-language model. It combines **license-clean** Arabic |
| OCR sources — synthetic documents, institutional invoices, and handwritten |
| text — into a single normalized `image + text` format, with a held-out eval |
| split for CER/WER benchmarking. |
|
|
| Quick links: |
| - 🤗 Model: [`context212/alhazen-ocr`](https://huggingface.co/context212/alhazen-ocr) |
| - 🛠️ Code (data pipeline, training, eval): [`github.com/context212/atlas-ocr`](https://github.com/context212/atlas-ocr) |
| - 📊 External benchmark: [`ahmedheakl/arocrbench_khatt`](https://huggingface.co/datasets/ahmedheakl/arocrbench_khatt) |
|
|
| ## What's in the dataset |
|
|
| Each row is one document image with its full transcription: |
|
|
| - `image`: the document image (page, crop, or line, depending on source) |
| - `text`: the transcription in natural reading order |
| - `source`: the upstream dataset the row came from |
|
|
| | Split | Rows | |
| |---|---| |
| | train | 52,726 | |
| | eval | 1,000 | |
|
|
| ## Source composition |
|
|
| The mix targets 60% synthetic documents, 20% invoices, 20% handwriting. Where |
| a source has fewer rows than its target share, all available rows are used. |
|
|
| | Source | Content | Rows used | License | |
| |---|---|---|---| |
| | [`loay/arabic-ocr-synthetic-scans-faker-300k`](https://huggingface.co/datasets/loay/arabic-ocr-synthetic-scans-faker-300k) | Synthetic Arabic document scans | 45,000 | CC-BY-4.0 | |
| | [`KhalfounMehdi/arabic-latin-invoices-synthetic`](https://huggingface.co/datasets/KhalfounMehdi/arabic-latin-invoices-synthetic) | Invoices (ar/en/fr) | 4,014 | CC-BY-4.0 | |
| | [`johnlockejrr/KHATT_v1.0_dataset`](https://huggingface.co/datasets/johnlockejrr/KHATT_v1.0_dataset) | Handwritten Arabic (KFUPM) | 4,672 | MIT | |
| | [`sherif1313/Historical-Arabic-Handwritten-OCR`](https://huggingface.co/datasets/sherif1313/Historical-Arabic-Handwritten-OCR) | Historical handwritten pages | 40 | Apache-2.0 | |
|
|
| **Deliberately excluded** on license grounds (non-commercial): |
| `aamijar/muharaf-public` (CC-BY-NC-SA), `freococo/*` (CC-BY-NC-ND). Every row |
| in this dataset comes from a commercially usable source. |
|
|
| ## Build pipeline |
|
|
| `scripts/build_dataset.py` in the repo above: |
|
|
| 1. Downloads each source from the Hub (with retry/backoff for rate limits) |
| 2. Normalizes every source to the `image + text` schema, renaming columns as |
| needed and casting to a common feature type |
| 3. Samples each source to its target share of the mix (seed 42, reproducible) |
| 4. Shuffles, splits off 1,000 rows for eval, and pushes both splits |
|
|
| Rebuild with: |
|
|
| ```bash |
| uv sync |
| HF_TOKEN=hf_... uv run python scripts/build_dataset.py |
| ``` |
|
|
| ## Intended use |
|
|
| - Training / fine-tuning Arabic OCR vision-language models |
| - Evaluating OCR robustness across printed, invoice, and handwritten Arabic |
| - The `eval` split is the held-out set used in the model card of |
| `context212/alhazen-ocr` — do not train on it |
|
|
| Not intended for: |
|
|
| - Languages other than Arabic/French/English (coverage is Arabic-first) |
| - High-stakes transcription without further validation |
|
|
| ## Limitations |
|
|
| - Roughly 85% of rows are synthetic documents; real scanned and handwritten |
| Arabic is a small minority, so models trained on this mix alone may |
| underperform on real handwriting (this shows up in the model's external |
| benchmark scores — see the model card) |
| - The historical handwriting source contributed only 40 usable image/text |
| pairs at build time |
| - Texts are not re-verified against the images; upstream transcription errors |
| carry through |
|
|
| ## Licensing / Terms of Use |
|
|
| All sources are permissively licensed for commercial use (CC-BY-4.0, MIT, |
| Apache-2.0). The dataset as a whole is released under CC-BY-4.0. If you use |
| it, credit the upstream sources listed above. |
|
|
| ## Citation |
|
|
| ```bibtex |
| @misc{alhazen_ocr_2026, |
| title = {Alhazen-OCR: an open Arabic-first OCR vision-language model}, |
| author = {Context212}, |
| year = {2026}, |
| url = {https://huggingface.co/context212/alhazen-ocr} |
| } |
| ``` |
|
|