Dataset Viewer
Auto-converted to Parquet Duplicate
image
imagewidth (px)
41
1.62k
text
stringlengths
1
54
যাচাই
বুঝতে পারা
সন্তুষ্ট
কঠোর
নিখুঁত
নিউটন
অল্পবয়স্ক
প্রচ্ছায়া
শতকরা
নিকৃষ্টতম
অবজেক্ট
বন্ধ্যা
পাশ্চাত্য ধারা
অষ্টপদী
মরচে ধরা নিব
বিলম্বিত করা
সমষ্টি
টেম্প-ফাইল
স্বদেশ যাওয়া
ডায়াল করার গতি
আত্নজীবনী
মানমন্দির
লাইন দেওয়া
দর্জি
অপয়া
সমাপতিত
রিপকৃত
যৌক্তিক
কেইথ
কমান্ড রান করা হচ্ছে
শেরিডান
বিস্তীর্ণভাবে
বাঁধ
ক্লাব
সিনেমা
খাড়া
ঔপনিবেশিক প্রশাসন
বৈঠা
মাত্রাতিরিক্ত মূল্য বিচার করা
অস্ট্রেলীয়
ছত্রাক
শিবির
ধীর
ব্যবহার করে
অন্ধকার ঘর
সয়ংক্রিয়ভাবে সনাক্ত করা
প্রত্যাবৃত্তি
উত্তপ্ত শলাকা দ্বারা পোড়ান
দীর্ঘকালীন
কেঁচে গণ্ডুষ করা
আত্মা
র্সাকিট
নিকটবর্তী
খাদ
হাসি মাসুদ
সিডি-টেক্সট
প্রাপ্তাধিকার
নিরর্থক
গতকালকের
হেলেদুলে চলা
বৃদ্ধি
জার্মানী
দক্ষিণ ইয়েমেন
আকাশগঙ্গা
নিশ্চিত
নিশ্চিতরূপে
জাঙসু
প্রলোভন
একক
সুয়েজ
অস্বাভাবিক
চমকপ্রদ
গণনযোগ্য
কভার ম্যানেজার
সদস্য
ট্রাস্ট
আতর
ধর্মোপদেশ
বিশুদ্ধ সুরাসার
চওড়া করা
লক্ষ্য রাখা
হিমমণ্ডল
বার্তা
যোগ্যতা
ঘুম থেকে জাগানো
প্রজাপতি
কে৫
অ্যানিমেটর
অধঃপতিত অবস্থা
প্রেক্ষাপট
ব্যাজ
নিচে
আইএসডিএন
কাঠগড়া
এনক্রিপ্ট
প্রশ্নপত্র
মহল
লাল
প্রসেস করা
শীর্ণ
End of preview. Expand in Data Studio

Bengali OCR Synthetic Dataset

A high-quality synthetic Bengali OCR dataset for fine-tuning vision-language models like DeepSeek-OCR 2. Generated using 100+ professional Bengali Unicode fonts and 13K+ unique Bengali words with advanced text rendering via FreeType and HarfBuzz.

Dataset Overview

  • Language: Bengali (বাংলা)
  • Task: Optical Character Recognition (OCR)
  • Format: Conversation-based (vision-language)
  • Total Samples: 30,000
  • Train: 27,007 samples
  • Validation: 2,993 samples

Dataset Features

  • Professional Typography: 100+ diverse Bengali fonts with various styles
  • 🎨 Color Variations: 16 different text/background combinations
  • 📐 Advanced Rendering: FreeType + HarfBuzz for proper Bengali complex script shaping
  • 📝 Rich Vocabulary: 13,218+ unique Bengali words
  • 🔤 Typography Effects: Optional faux bold and italic effects
  • 📏 Natural Spacing: Random letter spacing for realism
  • 🖼️ High Quality: 4x supersampled rendering with LANCZOS downsampling

Dataset Statistics

Metric Value
Total Samples 30,000
Training Samples 27,007
Validation Samples 2,993
Unique Words 13,218
Font Families 440
Color Combinations 16
Vocab Size 13234
Rendering Engine FreeType + HarfBuzz

Quick Start

Load with HuggingFace Datasets

from datasets import load_dataset

# Load training split
dataset = load_dataset("rifathridoy/bengali-ocr-synthetic", split="train")

# Access a sample
sample = dataset[0]
image = sample['image']  # PIL Image object
text = sample['text']    # Bengali text string

Load with HuggingFace from JSON

from datasets import load_dataset

dataset = load_dataset(
    "json",
    data_files={
        "train": "data/train.jsonl",
        "validation": "data/validation.jsonl"
    }
)

Custom Loading

import json
from PIL import Image
from pathlib import Path

def load_samples(split="train"):
    jsonl_file = Path(f"data/{split}.jsonl")
    samples = []
    with open(jsonl_file, encoding="utf-8") as f:
        for line in f:
            data = json.loads(line)
            samples.append(data)
    return samples

samples = load_samples("train")
print(f"Loaded {len(samples)} samples")

Data Format

Each sample follows the conversation format for vision-language models:

{
  "messages": [
    {
      "role": "<|User|>",
      "content": "<image>\nPlease read the Bengali text.",
      "images": ["data/images/000001_NotoSansBengali_Bold_word.png"]
    },
    {
      "role": "<|Assistant|>",
      "content": "Bengali text here"
    }
  ]
}

File Structure

output/
├── data/
│   ├── train.jsonl              # Training samples (conversation format)
│   ├── validation.jsonl         # Validation samples
│   └── images/                  # All synthetic images
│       ├── 000001_Font_Style_word.png
│       ├── 000002_Font_Style_word.png
│       └── ...
├── dataset_config.yaml          # OCR model configuration
├── dataset_config.json          # Configuration (JSON format)
├── dataset_info.json            # HuggingFace dataset metadata
├── metadata.json                # Generation metadata
├── DATASET_CARD.md              # Dataset card for HF Hub
└── README.md                    # This file

Generation Details

Text Rendering

  • Engine: FreeType 2.13 + HarfBuzz 3.0 (complex script shaping)
  • Supersampling: 4x for high-quality glyphs
  • Downsampling: LANCZOS for smooth reduction
  • Padding: 10 pixels around text
  • Format: PNG 8-bit grayscale + RGB with colors

Font Sources

  • Source: 100+ Bengali Unicode fonts from diverse foundries
  • Families: Noto Sans Bengali, Kalpurush, Nikosh, and 100+ others
  • Styles: Regular, Bold, Italic, BoldItalic variants

Text Sources

  • Primary: 229 Bengali words from original dataset
  • Secondary: 12,989 Bengali words extracted from bilingual dictionaries
  • Total: 13,218 unique words after deduplication

Augmentations

  • Faux Bold: Applied with 30% probability, strength 2 pixels
  • Faux Italic: Applied with 20% probability, shear 0.1
  • Color Combinations: 16 foreground/background pairs
  • Letter Spacing: Random (-1 to +4 pixels)

Train/Test Split

  • Training: 90% (27,007 samples)
  • Validation: 10% (2,993 samples)
  • Random Seed: 42 (reproducible)

Configuration

The dataset includes dataset_config.yaml with:

  • Character-to-index mapping (id2label)
  • Image preprocessing settings (normalization, resizing)
  • OCR-specific configuration (max_length=128)
  • Generation statistics and metadata

Usage Examples

Fine-tuning with Unsloth (Recommended)

from datasets import load_dataset
from unsloth import FastLanguageModel
import torch

# Load dataset
dataset = load_dataset("rifathridoy/bengali-ocr-synthetic")

# Your fine-tuning code here
# See: https://github.com/unslothai/unsloth

With DeepSeek-OCR 2

from datasets import load_dataset
from transformers import AutoModelForVision2Seq, AutoProcessor

model = AutoModelForVision2Seq.from_pretrained("deepseek-ocr-2-3b")
processor = AutoProcessor.from_pretrained("deepseek-ocr-2-3b")

dataset = load_dataset("rifathridoy/bengali-ocr-synthetic", split="train[:100]")

# Fine-tuning code...

License

This dataset is released under the CC-BY-4.0 License.

You are free to:

  • Share and distribute the dataset
  • Adapt and create derivatives
  • Use for commercial purposes

You must:

  • Give appropriate credit
  • Link to the license
  • Indicate changes made

Citation

If you use this dataset, please cite:

@dataset{bengali_ocr_synthetic_2026,
  title={Bengali OCR Synthetic Dataset},
  author={Generated with dataset_generator.py},
  year={2026},
  publisher={HuggingFace Hub},
  url={https://huggingface.co/datasets/rifathridoy/bengali-ocr-synthetic},
  license={CC-BY-4.0}
}

Uploading to HuggingFace Hub

# Install HuggingFace CLI
pip install huggingface-hub

# Create repository
huggingface-cli repo create bengali-ocr-synthetic --type dataset

# Clone and upload
git clone https://huggingface.co/datasets/YOUR_USERNAME/bengali-ocr-synthetic
cd bengali-ocr-synthetic
cp -r ../output/* .
git add .
git commit -m "Initial: Bengali OCR synthetic dataset"
git push

# Or use direct upload
hf upload-large-folder rifathridoy/bengali-ocr-synthetic . --repo-type=dataset

Support

  • 🐛 Issues: Open an issue on HuggingFace Hub
  • 💡 Suggestions: Contribute improvements via Pull Request
  • 📧 Contact: See HF Hub repository

Related Work


Generated: 2026-02-24
Format: HuggingFace-compatible with Parquet and JSONL
Status: Ready for fine-tuning

Downloads last month
183