SAQR / README.md
mahmoudsalah01's picture
Add dataset card
d3ebc0b verified
metadata
annotations_creators:
  - expert-generated
language_creators:
  - found
language:
  - ar
license: cc-by-4.0
multilinguality:
  - monolingual
size_categories:
  - 1K<n<10K
source_datasets:
  - original
task_categories:
  - image-to-text
  - image-classification
  - image-feature-extraction
task_ids: []
pretty_name: 'SAQR: A Paired Printed–Handwritten Arabic Line Dataset'
dataset_info:
  features:
    - name: pair_id
      dtype: int64
    - name: gt_image
      dtype: image
    - name: hw_image
      dtype: image
    - name: text
      dtype: string
    - name: category
      dtype:
        class_label:
          names:
            '0': boys
            '1': girls
    - name: split
      dtype: string
    - name: student_id
      dtype: string
    - name: form_creator
      dtype: string
  splits:
    - name: train
      num_examples: 1575
    - name: validation
      num_examples: 335
    - name: test
      num_examples: 353

SAQR: A Paired Printed–Handwritten Arabic Line Dataset for Handwriting Recognition and Cross-Modal Retrieval

Paper: SAQR: A Paired Printed–Handwritten Arabic Line Dataset for Handwriting Recognition and Cross-Modal Retrieval
Journal: Scientific Data (Nature/Springer) — under review
Contact: mahmoud.salah@aun.edu.eg


Dataset Summary

SAQR is a large-scale paired Printed Ground Truth – Handwritten (GT-HW) Arabic dataset collected from 331 Arabic-speaking students aged 12–22. Each sample pairs a printed reference line image with the corresponding student handwriting, providing rich supervision for Arabic Handwritten Text Recognition (HTR) and related vision tasks.

Property Value
Total pairs 2,263 GT-HW line pairs
Writers 331 students (age 12–22)
Gender 1,207 male / 1,056 female
Total words 25,352
Total characters 111,437 Arabic characters
Unique vocabulary 4,047 word types
Unique characters 47
Avg. line length 49.2 chars / 11.2 words
Splits Train 1,575 / Val 335 / Test 353 (writer-independent)
Language Arabic (Modern Standard Arabic / formal prose)
License CC-BY 4.0

Dataset Preview

Sample GT–HW line pairs from SAQR, showing the range of handwriting styles across the writer population (printed ground truth on top, student handwriting below):

Sample GT-HW pairs

Supported Tasks

Task Description
Handwritten Text Recognition (HTR) Transcribe hw_image → Arabic text
Gender Classification Predict writer gender from hw_image
GT-HW Cross-Modal Matching Match gt_imagehw_image across 353 candidates

Dataset Structure

Each sample contains:

  • pair_id — unique integer identifier
  • gt_image — image of the printed Arabic text line (Ground Truth)
  • hw_image — image of the handwritten copy (student writing)
  • text — Arabic transcription string
  • category — writer gender (0=boys / 1=girls)
  • splittrain / val / test
  • student_id — anonymized form identifier
  • form_creator — form template identifier

Loading the Dataset

Full dataset

from datasets import load_dataset

ds = load_dataset("mahmoudsalah01/SAQR")
train = ds["train"]
val   = ds["validation"]
test  = ds["test"]

# Access a sample
sample = train[0]
print(sample["text"])        # Arabic transcription
sample["gt_image"].show()    # Printed GT line
sample["hw_image"].show()    # Handwritten line

HTR task (HW image → text)

from datasets import load_dataset
ds = load_dataset("mahmoudsalah01/SAQR", split="train")
for sample in ds:
    image = sample["hw_image"]   # Input image
    label = sample["text"]       # Target transcription

Gender classification task

from datasets import load_dataset
ds = load_dataset("mahmoudsalah01/SAQR", split="train")
for sample in ds:
    image  = sample["hw_image"]    # Input: handwriting image
    gender = sample["category"]    # 0=boys, 1=girls

Benchmark Results

Task 1 — Handwritten Text Recognition

Method CER ↓ WER ↓
Tesseract 4.0 (zero-shot) 0.565 1.061
EasyOCR (zero-shot) 0.485 1.045
TrOCR-Base (fine-tuned, ours) 0.533 0.721

Task 2 — Gender Classification from Handwriting

Method Accuracy F1-Macro
ViT-Base (fine-tuned, ours) 73.5% 0.71

Task 3 — GT-HW Cross-Modal Matching (pool = 353)

Method R@1 R@10 MRR
CLIP ViT-B/32 (zero-shot) 0.6% 7.1% 3.2%
DINOv2 Siamese 1.7% 11.0% 5.6%
Fine-tuned CLIP 5.9% 26.3% 12.9%
Siamese ViT (InfoNCE) 5.4% 36.5% 15.0%
Siamese ViT + Hard Neg (ours) 10.8% 31.7% 17.7%

Collection Methodology

Students copied text lines from printed forms (Arabic formal prose, sourced from newspaper articles) onto A4 paper sheets. Forms were scanned at 300 DPI, line-segmented, and paired by form index. Transcriptions were extracted from original .docx form templates. Splits are writer-independent: no writer appears in more than one split.

License

Creative Commons Attribution 4.0 International (CC BY 4.0)

Contact

Mahmoud Salahmahmoud.salah@aun.edu.eg
For questions or issues, please open a Discussion.