File size: 2,199 Bytes
3ba0e9a 7b4f168 3ba0e9a 8ca381c 124ac17 8ca381c 3ba0e9a 326fcce 3ba0e9a 326fcce 3ba0e9a 326fcce b13b351 c31143f 87bb8e4 |
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 |
---
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
tags:
- dataset
---
### Dataset Description
This dataset is designed for training and evaluating Optical Character Recognition (OCR) models
for Arabic text. It is an extension of an open-source dataset and includes text rendered in multiple Arabic fonts (Amiri, Sakkal Majalla, Arial, Calibri and Scheherazade New).
The dataset simulates real-world book layouts to enhance OCR accuracy.
### Dataset Structure
The dataset is divided into five splits based on font name (Sakkal_Majalla, Amiri, Arial, Calibri, and Scheherazade_New).
Each split contains data specific to a single font. Within each split, the following attributes are present:
- **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.
### How to Use
```python
from datasets import load_dataset
import base64
from io import BytesIO
from PIL import Image
# Load dataset with streaming enabled
ds = load_dataset("xya22er/text_to_image", streaming=True)
print(ds)
# Load the dataset
# 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))
# Show the image (optional)
image.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
```
# OCR Dataset Generation Pipeline
To create your own dataset, you can use the following repository: [text2image](https://github.com/riotu-lab/text2image). |