alm7zm's picture
Document OpenITI-Makhzan subset; restore standard LFS .gitattributes
23ca3b4 verified
|
Raw History Blame Contribute Delete
14.9 kB
---
pretty_name: Arabic Manuscript Collection
language:
- ar
task_categories:
- image-to-text
tags:
- ocr
- htr
- handwriting-recognition
- arabic
- manuscripts
size_categories:
- 10K<n<100K
license: other
license_name: mixed-per-subset
configs:
- config_name: Omar-al-Saleh
data_files:
- split: train
path: Omar-al-Saleh/train.csv
- split: validation
path: Omar-al-Saleh/val.csv
- split: test
path: Omar-al-Saleh/test.csv
- config_name: Muharaf
data_files:
- split: train
path: Muharaf/train.csv
- split: validation
path: Muharaf/val.csv
- split: test
path: Muharaf/test.csv
- config_name: AraMs-28k-HTR
data_files:
- split: train
path: AraMs-28k-HTR/train.csv
- split: validation
path: AraMs-28k-HTR/val.csv
- split: test
path: AraMs-28k-HTR/test.csv
- config_name: AHDQ
data_files:
- split: train
path: AHDQ/train.csv
- split: validation
path: AHDQ/val.csv
- split: test
path: AHDQ/test.csv
- config_name: KHATT
data_files:
- split: train
path: KHATT/train.csv
- split: validation
path: KHATT/val.csv
- split: test
path: KHATT/test.csv
- config_name: AMIDDA
data_files:
- split: train
path: AMIDDA/data/train-*.parquet
- split: validation
path: AMIDDA/data/validation-*.parquet
- split: test
path: AMIDDA/data/test-*.parquet
- config_name: OpenITI-Makhzan_Metadata_2026-1-2
data_files:
- split: train
path: OpenITI-Makhzan_Metadata_2026-1-2/train.csv
- split: validation
path: OpenITI-Makhzan_Metadata_2026-1-2/val.csv
- split: test
path: OpenITI-Makhzan_Metadata_2026-1-2/test.csv
---
# Arabic Manuscript Collection
Seven Arabic handwritten text recognition (HTR) subsets. Five are converted to **one layout**
and **one label format** so they can be trained and evaluated together: **82,561 labelled
images** in total. Two are republished closer to their source shape: AMIDDA as upstream
Parquet, and OpenITI-Makhzan as page images with line-level coordinates.
Four of the five converted sources are historical manuscripts. KHATT is modern handwriting
and is included as a separate, optional subset.
> **AMIDDA overlaps Muharaf and KHATT.** AMIDDA bundles its own copies of `muharaf-public`
> (24,494 lines) and KHATT v1.0 (6,673 lines), split independently of the `Muharaf` and
> `KHATT` subsets here. Training on AMIDDA and evaluating on `Muharaf`/`KHATT` test (or the
> reverse) leaks lines across the split boundary. Use one or the other, or filter AMIDDA on
> its `dataset` column.
Curated by **TheSeniorTeam**, a PSU senior project supervised by Prof. Samer Samarah.
We fine-tune an open vision-language model on historical Arabic handwriting and evaluate
it with CER/WER on held-out manuscripts. This repository is that project's data module.
## Subsets
| Subset | Train | Val | Test | Total | Unit | Content | Diacritised lines | License |
|---|---:|---:|---:|---:|---|---|---:|---|
| **Omar-al-Saleh** | 15,164 | 798 | 2,095 | 18,057 | line | Handwritten memoirs, 1951–1965, 16 documents | ~3% | CC BY 4.0 |
| **Muharaf** | 22,092 | 1,069 | 1,334 | 24,495 | line | Historic letters, journals, poetry, church and legal records | ~35% | CC BY-NC-SA 4.0 |
| **AraMs-28k-HTR** | 19,739 | 1,486 | 6,744 | 27,969 | line | 14 books: 13 manuscripts in Naskh, Ruq'ah and Maghrebi scripts, plus 1 lithographed edition | 0% | CC BY-NC-SA 4.0 |
| **AHDQ** | 579 | 31 | 32 | 642 | **page** | Binarized handwritten Quran pages, 6 handwriting styles | 100% | MIT |
| *KHATT* | *8,094* | *1,901* | *1,403* | *11,398* | *line* | *Modern unconstrained handwriting, 838 writers* | *0%* | *Research use (see below)* |
| *AMIDDA* | *53,420* | *6,675* | *6,684* | *66,779* | *line* | *Upstream aggregate of 8 corpora: Maghrebi and Oriental Arabic manuscripts, lithography, modern cursive* | *mixed* | *Per source (see below)* |
| *OpenITI-Makhzan_Metadata_2026-1-2* | *18,447* | *2,343* | *2,289* | *23,079* | *line on a **page** image* | *208 documents, 1,497 pages. Multilingual: Arabic 12,773, Persian 5,381, Ottoman Turkish 3,654, Urdu 1,055. Six scripts, led by naskh and nastaliq* | *27%* | *Unverified (see below)* |
For the five converted subsets, every CSV row has a matching image file, and the train,
validation and test splits share no images. Two subsets differ: AMIDDA ships Parquet with
embedded images and no CSV, and `OpenITI-Makhzan_Metadata_2026-1-2` has many
rows per image, because its images are whole pages and each row is one line inside a page
(median 14 lines per page, up to 74).
**AHDQ is page-level.** Each image is a full page with a median of about 940 characters of
text, up to 3,600. Every other subset uses line crops with a median of 47–70 characters.
Batch AHDQ separately, or filter it out if your model has a short context.
## Layout
```
<Subset>/
images.zip # contains images/train/, images/val/, images/test/
train.csv # image_path,text
val.csv
test.csv
```
`AMIDDA/` does not follow this layout. It is the upstream Parquet release, images embedded:
```
AMIDDA/
data/train-*.parquet, validation-*.parquet, test-*.parquet
README.md # upstream card: per-corpus stats and baselines
```
`OpenITI-Makhzan_Metadata_2026-1-2/` keeps the `images.zip` + CSV shape but **not** the
two-column schema. Its 22 columns carry page-level line coordinates and catalogue metadata:
| Column group | Columns |
|---|---|
| Text | `text` |
| Image | `image_file` (a page, not a line crop), `page_id`, `page_number` |
| Geometry | `bbox_x`, `bbox_y`, `bbox_width`, `bbox_height`, `polygon` (all rows populated) |
| Provenance | `document_id`, `shelfmark`, `line_id`, `line_number`, `source_pdf` |
| Catalogue | `lang`, `script`, `genre`, `form`, `document_type` |
| QA | `transcriber`, `vetter`, `vetting_status` (every row vetted at least once) |
The geometry columns make this the only subset you can use for line segmentation or
layout analysis, not just recognition. To train a line recogniser on it, crop each line
from its page with `bbox_*` or `polygon` first.
- `image_path` is a bare filename inside `images/<split>/`. The CSV's name already
says which split it belongs to.
- `text` is the ground-truth transcription in Unicode Arabic, not normalized. Diacritics
(tashkeel), punctuation and digits are kept exactly as the source provides them.
- Images are PNG, except KHATT, which uses JPG.
Extra files:
| File | What it is |
|---|---|
| `AraMs-28k-HTR/metadata.csv` | Per-line provenance: `book_id`, `page_id`, `line_idx`, `line_type`, `split`. The `img_path` column predates the reorganisation, so join to the split CSVs on the filename. |
| `AraMs-28k-HTR/split_used.json` | Which books are in which split. |
| `AraMs-28k-HTR/dataset_stats.json` | Line, page and book counts per split and per book. |
| `AHDQ/labels.csv` | The original unsplit label file for all 642 pages (`file_name,text`). |
| `KHATT/khatt-label-decoder.ipynb` | Decodes KHATT's Latin transliteration codes into Arabic (see below). |
## Usage
**Text only**, for example to inspect labels or build a vocabulary:
```python
from datasets import load_dataset
ds = load_dataset("TheSeniorTeam/Arabic_Manuscript_Collection_Dataset", "Muharaf")
```
AMIDDA is Parquet, so the same call returns its images too, no zip handling needed:
```python
ds = load_dataset("TheSeniorTeam/Arabic_Manuscript_Collection_Dataset", "AMIDDA")
```
`OpenITI-Makhzan_Metadata_2026-1-2` loads the same way as the CSV subsets, but
remember `image_file` names a page and the row is one line inside it:
```python
ds = load_dataset("TheSeniorTeam/Arabic_Manuscript_Collection_Dataset",
"OpenITI-Makhzan_Metadata_2026-1-2")
arabic_naskh = ds["train"].filter(lambda x: x["lang"] == "ara" and x["script"] == "naskh")
```
**With images:**
```python
import zipfile
import pandas as pd
from huggingface_hub import hf_hub_download
repo, subset, split = "TheSeniorTeam/Arabic_Manuscript_Collection_Dataset", "Muharaf", "train"
zipfile.ZipFile(hf_hub_download(repo, f"{subset}/images.zip", repo_type="dataset")).extractall(subset)
df = pd.read_csv(hf_hub_download(repo, f"{subset}/{split}.csv", repo_type="dataset"))
df["image"] = f"{subset}/images/{split}/" + df["image_path"]
```
**Whole repo** (about 19.4 GB: AMIDDA 8.9 GB, OpenITI-Makhzan 6.1 GB, the rest 4.4 GB):
```bash
hf download TheSeniorTeam/Arabic_Manuscript_Collection_Dataset --repo-type dataset --local-dir .
```
## Splits: which are official and which we made
**Do not re-split these subsets by line.** A line-level split puts the same writer or
book in both train and test, so test scores measure memorisation instead of
generalisation.
| Subset | Train / test | Validation |
|---|---|---|
| Omar-al-Saleh | Official | **Ours.** 5% of official train, seed 0 |
| Muharaf | Official | Official |
| AraMs-28k-HTR | Official and **split by book**: 9 train, 2 val, 3 test books | Official |
| AHDQ | **Ours.** No upstream split. 90/5/5, stratified by style so all six styles appear in every split | Ours |
| KHATT | Train official. **Test is ours:** 104 of 691 train writers held out, seed 3, split by writer | Official, writer-disjoint from train |
| AMIDDA | Upstream, unchanged | Upstream, unchanged |
| OpenITI-Makhzan_Metadata_2026-1-2 | As shipped, and **document-disjoint**: 98 train, 54 val, 56 test documents, no document or page in two splits | As shipped |
- **Omar-al-Saleh:** The 2,671-line **blind test** set from the NAKBA NLP 2026 shared task
is **deliberately not included**, so it can't end up in training by accident.
Upstream train has 15,969 rows. This copy has 15,962; the 7-row gap comes from upstream.
- **AHDQ:** The style is encoded in the filename prefix: `dmn_`, `sdc_`, `sas_`, `sal_`,
`sbi_`, `sfm_`.
- **KHATT:** `KHATT_v1.0` ships a test split but exposes no writer ID, so there is no way to
check that it shares no writers with this train set. We held out our own test set instead.
## KHATT is optional
KHATT is modern handwriting (1,000 writers originally, 838 in this copy), not manuscripts.
It is here for pre-training or comparison. Leave it out if you are measuring manuscript HTR.
The upstream CSVs label each line as Latin transliteration codes, one per column
(`ke la sp ah na …`). We decoded them into Arabic with the Arabic-Latin lookup table in
the KHATT v1.0 readme, plus 4 lam-alef ligature codes the table leaves out. All 67 codes
resolve, covering 100% of tokens in both upstream CSVs, so no character was guessed.
`khatt-label-decoder.ipynb` reproduces the decoding. Upstream CSVs name images `.tif`,
but the files are `.jpg`; this copy uses the real filenames.
## Known limitations
- **No `source` or `document_id` column yet.** Document grouping is only partly available:
AraMs has `book_id` in `metadata.csv`, AHDQ has the style prefix, and Muharaf and this
Omar copy expose none. Until an ID column exists, you can't safely create a new split.
- **Diacritics vary by subset**, from 0% (AraMs, KHATT) to 100% (AHDQ). A model trained on
a mix has to learn when tashkeel is expected. Report CER both with and without
diacritics.
- **`OpenITI-Makhzan_Metadata_2026-1-2` catalogue columns are not normalised.** `form`
mixes case and has at least one corrupt value (`prose`, `Prose`, `poetry`, `Poetry`,
`Prose, Poetry`, `ProseProse`, `calligraphed heading`). `source_pdf` is filled for only
23% of rows. Normalise case before grouping on these.
- A handful of Muharaf and Omar transcriptions contain a newline inside the text field,
and one Muharaf train row has empty text. Use a real CSV parser, not line splitting.
- Omar-al-Saleh has a single writer, so good test scores there say little about other hands.
## Licensing
There is **no single license.** Each subset keeps its upstream terms, and using the
collection as a whole means following all of them. The two CC BY-NC-SA subsets make any
combined use **non-commercial**.
| Subset | License | Upstream |
|---|---|---|
| Omar-al-Saleh | CC BY 4.0 | [`U4RASD/omar-al-saleh-manuscripts-segments`](https://huggingface.co/datasets/U4RASD/omar-al-saleh-manuscripts-segments) (Doha Institute) |
| Muharaf | CC BY-NC-SA 4.0 | [`aamijar/muharaf-public`](https://huggingface.co/datasets/aamijar/muharaf-public) |
| AraMs-28k-HTR | CC BY-NC-SA 4.0 | [Zenodo 10.5281/zenodo.22095333](https://doi.org/10.5281/zenodo.22095333) |
| AHDQ | MIT | [Kaggle](https://www.kaggle.com/datasets/abdoukhadrembacke/ahdq-arabic-handwriting-dataset-from-quran) |
| KHATT | Free for research, distributed by KFUPM. Check their terms before redistributing. | [KHATT, KFUPM](https://doi.org/10.1016/j.patcog.2013.08.009) |
| AMIDDA | `other`, and per-source on top: 8 upstream corpora with their own terms. Check before any redistribution or commercial use. | [`calfa-ai/AMIDDA`](https://huggingface.co/datasets/calfa-ai/AMIDDA) |
| OpenITI-Makhzan_Metadata_2026-1-2 | **Not yet verified.** The upstream terms for this release have not been confirmed, and the 208 documents come from multiple holding libraries with their own shelfmarks. Treat as all-rights-reserved until checked. | OpenITI / Makhzan (to be confirmed) |
## Citation
If you use a subset, cite its original authors:
```bibtex
@misc{saeed2024muharaf,
title = {Muharaf: Manuscripts of Handwritten Arabic Dataset for Cursive Text Recognition},
author = {Saeed, Mehreen and Chan, Adrian and Mijar, Anupam and Moukarzel, Joseph and Habchi, Georges and Younes, Carlos and Elias, Amin and Wong, Chau-Wai and Khater, Akram},
year = {2024},
eprint = {2406.09630},
archivePrefix = {arXiv},
note = {NeurIPS 2024}
}
@misc{guechaoui2026arams28k,
title = {AraMS-28k: The Largest Publicly Released Line-Level Dataset of Historical Arabic Manuscripts with Margin and Insertion-Anchor Annotations},
author = {Guechaoui, Mohamed and Zellagui, Mohamed Diaa and Chaib, Souleyman and Dhelim, Sahraoui},
year = {2026},
eprint = {2608.26921},
archivePrefix = {arXiv}
}
@article{mahmoud2014khatt,
title = {KHATT: An Open Arabic Offline Handwritten Text Database},
author = {Mahmoud, Sabri A. and Ahmad, Irfan and Al-Khatib, Wasfi G. and Alshayeb, Mohammad and Parvez, Mohammad Tanvir and M{\"a}rgner, Volker and Fink, Gernot A.},
journal = {Pattern Recognition},
volume = {47},
number = {3},
pages = {1096--1112},
year = {2014},
doi = {10.1016/j.patcog.2013.08.009}
}
```
- **Omar-al-Saleh:** *NAKBA NLP 2026: Shared Task on Arabic Handwritten Manuscript
Understanding*, 2nd International Workshop, co-located with LREC 2026, Palma, Mallorca.
- **AHDQ:** XIDMA_AI (2024). *AHDQ (Arabic Handwriting Dataset from Quran)*. Kaggle.
- **AMIDDA:** Calfa, [`calfa-ai/AMIDDA`](https://huggingface.co/datasets/calfa-ai/AMIDDA). Cite the
eight upstream corpora listed on that card, not AMIDDA alone.