--- dataset_info: features: - name: image dtype: image - name: text dtype: string - name: style dtype: string splits: - name: train num_bytes: 12777680156 num_examples: 1300000 - name: noisy_Bg num_bytes: 564270458 num_examples: 100000 - name: parabolic_text num_bytes: 964652903 num_examples: 100000 - name: parabolic_text_blur num_bytes: 1036157860 num_examples: 100000 - name: parabolic_text_shadow num_bytes: 1164050759 num_examples: 100000 - name: plain_text num_bytes: 481267597 num_examples: 100000 - name: plain_text_blur num_bytes: 691000068 num_examples: 100000 - name: plain_text_complex_bg num_bytes: 3899110442 num_examples: 100000 - name: plain_text_darkness num_bytes: 347759418 num_examples: 100000 - name: plain_text_shadow num_bytes: 818234147 num_examples: 100000 - name: sine_text num_bytes: 325560397 num_examples: 100000 - name: sine_text_blur num_bytes: 1081370287 num_examples: 100000 - name: sine_text_darkness num_bytes: 1277542234 num_examples: 100000 - name: white_noise num_bytes: 471704986 num_examples: 100000 download_size: 25905171625 dataset_size: 25900361712 configs: - config_name: default data_files: - split: train path: data/train-* - split: noisy_Bg path: data/noisy_Bg-* - split: parabolic_text path: data/parabolic_text-* - split: parabolic_text_blur path: data/parabolic_text_blur-* - split: parabolic_text_shadow path: data/parabolic_text_shadow-* - split: plain_text path: data/plain_text-* - split: plain_text_blur path: data/plain_text_blur-* - split: plain_text_complex_bg path: data/plain_text_complex_bg-* - split: plain_text_darkness path: data/plain_text_darkness-* - split: plain_text_shadow path: data/plain_text_shadow-* - split: sine_text path: data/sine_text-* - split: sine_text_blur path: data/sine_text_blur-* - split: sine_text_darkness path: data/sine_text_darkness-* - split: white_noise path: data/white_noise-* license: cc-by-4.0 task_categories: - image-to-text language: - fa - ar tags: - OCR - optical-character-recognition - text-recognition - image-to-text - persian - farsi - persian-ocr - synthetic - computer-vision - deep-learning - persian-OCR pretty_name: 'Garshasp-70C: Persian Synthetic OCR Dataset' size_categories: - 1M Please fill in the exact details of your preprocessing so others can better understand and reproduce the pipeline. ### Fonts The Persian text is rendered using **82 fonts from 18 font families**, including: 1. Arial 2. B Homa 3. B Lotus 4. B Mitra 5. B Tir 6. B Traffic 7. B Yagut 8. B Zar 9. B Nazanin 10. Calibri 11. Dubai 12. Estedad 13. Far Farnaz 14. IRANSans 15. Sahel 16. Shabnam 17. Tahoma 18. Vazir / Vazirmatn (Several weights and variants of these families are used to reach a total of 82 fonts.) ### Rendering - All images are rendered as **RGB** with **fixed size 48×640** (height × width). - Text is laid out to fit within the 640-pixel width, with at most 70 characters per image. - Different styles control geometric distortion and background / noise: - **Geometric distortions** - `sine_text`: sinusoidal warping of text baselines - `parabolic_text`: parabolic / curved baselines and perspective-like distortion - **Photometric / noise effects** - Blur (`*_blur`) - Dark / low-light (`*_darkness`) - Shadows (`*_shadow`) - Complex backgrounds (`plain_text_complex_bg`) - White noise and noisy backgrounds (`white_noise`, `noisy_Bg`) ### Synthetic nature This dataset is **fully synthetic**: - Persian text is sampled from a corpus and rendered with multiple fonts. - Distortions and augmentations simulate conditions such as: - screenshots and UI text - signs, banners, boards - noisy / low-quality photos - documents with various backgrounds Although synthetic, the pipeline is designed to **approximate real-world Persian OCR** as much as possible. --- ## Usage ### Load with 🤗 Datasets ```python from datasets import load_dataset dataset = load_dataset("AliShafiee2003/persian-ocr-garshasp", split="train") example = dataset[0] image = example["image"] # PIL.Image.Image (48x640, RGB) text = example["text"] # str (Persian) style = example["style"] # str ```` ### Streaming (recommended for full dataset) ```python from datasets import load_dataset streaming_dataset = load_dataset( "AliShafiee2003/persian-ocr-garshasp", split="train", streaming=True, ) for example in streaming_dataset: image = example["image"] text = example["text"] style = example["style"] # training loop here ``` ### PyTorch example ```python from datasets import load_dataset from torch.utils.data import DataLoader from torchvision import transforms dataset = load_dataset( "AliShafiee2003/persian-ocr-garshasp", split="train", ) transform = transforms.Compose([ transforms.ToTensor(), ]) def collate_fn(batch): images = [transform(x["image"]) for x in batch] texts = [x["text"] for x in batch] styles = [x["style"] for x in batch] return { "pixel_values": images, "labels": texts, "styles": styles, } dataloader = DataLoader( dataset, batch_size=32, shuffle=True, collate_fn=collate_fn, ) ``` --- ## Intended uses Recommended use-cases: * Training and evaluation of **OCR models for Persian (Farsi)**. * Pretraining scene text recognition models on synthetic data before fine-tuning on: * real scanned documents, * mobile photos of text, * screenshots / UI text. * Robustness studies under: * geometric distortions (sine / parabolic), * blur and shadows, * noisy and complex backgrounds, * low-light conditions. Not recommended for: * Handwritten text recognition (this dataset focuses on **printed** text). * Pure NLP / language modeling tasks (the text is primarily used as labels for images). --- ## License This dataset is released under the **Creative Commons Attribution 4.0 International (CC BY 4.0)** license. You are free to: - **Share** — copy and redistribute the material in any medium or format - **Adapt** — remix, transform, and build upon the material for any purpose, **even commercially** Under the following terms: - **Attribution** — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. For more details, see the full license text: https://creativecommons.org/licenses/by/4.0/ --- ## Citation If you use **Persian OCR Garshasp** in your research or product, please cite: ```bibtex @misc{persian_ocr_garshasp, title = {Persian OCR Garshasp: Large-Scale Synthetic OCR Dataset for Persian (Farsi)}, author = {Shafiee, Ali}, year = {2025}, howpublished = {\url{https://huggingface.co/datasets/AliShafiee2003/persian-ocr-garshasp-70c}}, note = {Version 1.0}, } ``` (Feel free to adjust the author list, year, and version to match your preferred citation.) --- ## خلاصه فارسی **Persian-OCR-Garshasp** یک دیتاست بزرگ برای **OCR فارسی** است که حدود **۲.۶ میلیون** جفت تصویر–متن دارد. هر نمونه شامل یک تصویر رنگی با سایز **۴۸×۶۴۰ پیکسل** و متن فارسی (حداکثر ۷۰ کاراکتر) به‌عنوان برچسب است. متن‌ها با استفاده از **۸۲ فونت از ۱۸ خانواده‌ی مختلف** (مثل B Nazanin، B Zar، IRANSans، Sahel، Shabnam، Vazir/Vazirmatn و …) رندر شده‌اند و روی آن‌ها انواع اعوجاج‌های هندسی (sine، parabolic) و نویزها (تاری، سایه، پس‌زمینه پیچیده، نویز سفید و …) اعمال شده است. این دیتاست **کاملا مصنوعی** است، اما سعی شده تا حد امکان به شرایط واقعی متن فارسی در تصاویر نزدیک باشد (اسکرین‌شات، تابلو، پوستر، عکس‌های نویزی، اسکن اسناد و غیره). از این دیتاست می‌توان برای آموزش و ارزیابی مدل‌های تشخیص متن فارسی، و همین‌طور پیش‌آموزش مدل‌ها قبل از فاین‌تیون روی دیتای واقعی استفاده کرد. این دیتاست تحت لایسنس **CC BY 4.0** منتشر شده است. یعنی. --- ## Keywords (for search & discoverability) persian ocr, farsi ocr, persian text recognition, farsi text recognition, persian scene text, persian document text, arabic script ocr, persian dataset, farsi dataset, synthetic ocr dataset, image to text, scene text recognition, document text recognition, persian news text, persian image text pairs, 48x640 images, noisy text images, sine text, parabolic text, white noise, shadow, blur, dark images, complex background, persian computer vision, persian deep learning