The dataset could not be loaded because the splits use different data file formats, which is not supported. Read more about the splits configuration. Click for more details.
Error code: FileFormatMismatchBetweenSplitsError
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
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
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.
- Downloads last month
- 38