File size: 5,636 Bytes
3ba0e9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7b4f168
 
 
4ceebd8
7b2f7ab
 
 
3ba0e9a
 
7b2f7ab
 
 
 
 
 
 
 
51c26ea
3ba0e9a
 
46ccd56
3ba0e9a
d90bbf7
 
3ba0e9a
d90bbf7
3ba0e9a
46ccd56
3ba0e9a
d90bbf7
326fcce
d90bbf7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326fcce
 
b13b351
 
 
 
d90bbf7
 
b13b351
46ccd56
b13b351
 
 
 
 
 
 
 
 
 
 
 
d90bbf7
 
 
 
 
 
b13b351
 
 
 
 
 
 
 
c31143f
 
d90bbf7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51c26ea
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
---
language:
- ar
configs:
- config_name: default
  data_files:
  - split: Amiri
    path: Amiri/*.csv
  - split: Sakkal_Majalla
    path: Sakkal_Majalla/*.csv
  - split: Arial
    path: Arial/*.csv
  - split: Calibri
    path: Calibri/*.csv
  - split: Scheherazade_New
    path: Scheherazade_New/*.csv
features:
  text:
    dtype: string
csv_options:
  delimiter: ','
  quotechar: '"'
  encoding: utf-8
tags:
- dataset
- OCR
- Arabic
- Image_To_Text
license: apache-2.0
task_categories:
- image-to-text
pretty_name: 'SAND: A Large-Scale Synthetic Arabic OCR Corpus for Vision-Language Models'
size_categories:
- 100K<n<1M
---

# SARD: Synthetic Arabic Recognition Dataset

[![Hugging Face Datasets](https://img.shields.io/badge/🤗%20Hugging%20Face-Datasets-yellow)](https://huggingface.co/datasets/riotu-lab/SAND)
[![GitHub](https://img.shields.io/badge/GitHub-Repository-blue)](https://github.com/riotu-lab/text2image)

## Overview

**SARD** (Synthetic Arabic Recognition Dataset) is a large-scale, synthetically generated dataset designed for training and evaluating Optical Character Recognition (OCR) models for Arabic text. This dataset addresses the critical need for comprehensive Arabic text recognition resources by providing controlled, diverse, and scalable training data that simulates real-world book layouts.

## Key Features

- **Massive Scale**: 743,000 document images containing 662.15 million words
- **Typographic Diversity**: Five distinct Arabic fonts (Amiri, Sakkal Majalla, Arial, Calibri, and Scheherazade New)
- **Structured Formatting**: Designed to mimic real-world book layouts with consistent typography
- **Clean Data**: Synthetically generated with no scanning artifacts, blur, or distortions
- **Content Diversity**: Text spans multiple domains including culture, literature, Shariah, social topics, and more

## Dataset Structure

The dataset is divided into five splits based on font name:

- **Amiri**: ~148,541 document images
- **Sakkal Majalla**: ~148,541 document images
- **Arial**: ~148,541 document images
- **Calibri**: ~148,541 document images
- **Scheherazade New**: ~148,541 document images

📋 Sample Images
<div align="center">
  <table>
    <tr>
      <td><img src="https://cdn-uploads.huggingface.co/production/uploads/64e8eb21233101ed99b204c8/gwF9jkkkpzRSzrP9GCE_l.png" width="300" alt="Sample 1 - Amiri Font"/></td>
      <td><img src="https://cdn-uploads.huggingface.co/production/uploads/64e8eb21233101ed99b204c8/dsqWoCh5x31eGq-u-PqPS.png" width="300" alt="Sample 2 - Arial Font"/></td>
    </tr>
    <tr>
      <td><img src="https://cdn-uploads.huggingface.co/production/uploads/64e8eb21233101ed99b204c8/2XK9Ey6k6HSDXKXCxmVRG.png" width="300" alt="Sample 3 - Calibri Font"/></td>
      <td><img src="https://cdn-uploads.huggingface.co/production/uploads/64e8eb21233101ed99b204c8/CxKITKvc3EnDIuqnNy_bV.png" width="300" alt="Sample 4 - Scheherazade Font"/></td>
    </tr>
  </table>
</div>

Each split contains data specific to a single font with the following attributes:

- `image_name`: Unique identifier for each image
- `chunk`: The text content associated with the image
- `font_name`: The font used in text rendering
- `image_base64`: Base64-encoded image representation

## Content Distribution

| Category | Number of Articles |
|----------|-------------------|
| Culture | 13,253 |
| Fatawa & Counsels | 8,096 |
| Literature & Language | 11,581 |
| Bibliography | 26,393 |
| Publications & Competitions | 1,123 |
| Shariah | 46,665 |
| Social | 8,827 |
| Translations | 443 |
| Muslim's News | 16,725 |
| **Total Articles** | **133,105** |

## Font Specifications

| Font | Words Per Page | Font Size |
|------|----------------|-----------|
| Sakkal Majalla | 50–300 | 14 pt |
| Arial | 50–500 | 12 pt |
| Calibri | 50–500 | 12 pt |
| Amiri | 50–300 | 12 pt |
| Scheherazade | 50–250 | 12 pt |

## Page Layout

| Specification | Measurement |
|---------------|-------------|
| Left Margin | 0.9 inches |
| Right Margin | 0.9 inches |
| Top Margin | 1.0 inch |
| Bottom Margin | 1.0 inch |
| Gutter Margin | 0.2 inches |
| Page Width | 8.27 inches (A4) |
| Page Height | 11.69 inches (A4) |

## Usage Example

```python
from datasets import load_dataset
import base64
from io import BytesIO
from PIL import Image
import matplotlib.pyplot as plt

# Load dataset with streaming enabled
ds = load_dataset("riotu-lab/SARD", streaming=True)
print(ds)

# Iterate over a specific font dataset (e.g., Amiri)
for sample in ds["Amiri"]:
    image_name = sample["image_name"]
    chunk = sample["chunk"]  # Arabic text transcription
    font_name = sample["font_name"]
    
    # Decode Base64 image
    image_data = base64.b64decode(sample["image_base64"])
    image = Image.open(BytesIO(image_data))

    # Display the image
    plt.figure(figsize=(10, 10))
    plt.imshow(image)
    plt.axis('off')
    plt.title(f"Font: {font_name}")
    plt.show()

    # Print the details
    print(f"Image Name: {image_name}")
    print(f"Font Name: {font_name}")
    print(f"Text Chunk: {chunk}")
    
    # Break after one sample for testing
    break
```


## Applications

SAND is designed to support various Arabic text recognition tasks:

- Training and evaluating OCR models for Arabic text
- Developing vision-language models for document understanding
- Fine-tuning existing OCR models for better Arabic script recognition
- Benchmarking OCR performance across different fonts and layouts
- Research in Arabic natural language processing and computer vision



## Acknowledgments

The authors thank Prince Sultan University for their support in developing this dataset.