You need to agree to share your Hugging Face information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

KhmerEduDoc

KhmerEduDoc is a 65,000-page Khmer educational document OCR dataset. Page images come from Khmer textbooks on the public digital library Sala Digital (https://sala.moeys.gov.kh/en). The transcriptions were generated automatically by a frozen teacher model, Gemini 3.7 Flash (gemini-3.7-flash, run between 14 and 23 August 2026). The dataset includes two human-verified evaluation sets.

The dataset is used to fine-tune and evaluate two OCR vision-language models with LoRA:

Splits

Split Pages Labels Description
train 61,750 Gemini (teacher) Training pages
validation 3,250 Gemini (teacher) Validation pages
test_setA 60 Human-verified Educational pages: 50 text-only, 10 with LaTeX
test_setB 100 Human-verified Older documents (publication dates 1952 to 2003)

train and validation together form the 65,000-page release, chosen from 4,407 books (342,156 pages) by cycling through books to maximize book coverage. test_setA and test_setB are disjoint from the release.

Data fields

Column Type Description
image Image Page image
text string Transcription in reading order. Tables are HTML, math is LaTeX (\[ \] block, \( \) inline)
book_id string Source book ID, parsed from the filename (may be empty for some Set B rows)
page int Page number in the book (may be empty for some Set B rows)
label_source string gemini (teacher label) or human (human-verified)
content_type string Only in test_setA: text_only or text_with_latex. Empty in other splits

Example row:

{"image": "<PIL image>", "text": "αž˜αž“αž»αžŸαŸ’αžŸαž˜αž·αž“αž›αŸ’αž’αž‚αŸ’αžšαž”αŸ‹αžŠαž”αŸ‹αž‘αŸ\nαžšαŸ€αž“αž˜αžΎαž›αž…αŸ†αžŽαž»αž…αž›αŸ’αž’αž‚αŸαž±αŸ’αž™αž”αžΆαž“αž…αŸ’αžšαžΎαž“αŸ”", "book_id": "66e7b04c3dbbe7c3c8ba6d1c", "page": 77, "label_source": "human", "content_type": "text_only"}

Usage

from datasets import load_dataset

ds = load_dataset("CADT-IDRI/KhmerEduDoc")
print(ds)
print(ds["test_setA"][0]["text"])

Converting to fine-tuning formats

The dataset stores plain image and text columns. To fine-tune the OCR models, convert each row into the chat format that model expects. Each line below is one training example (<path> is the saved image path).

DeepSeek-OCR-2 (prompt <image>\nFree OCR.):

{"messages": [{"role": "<|User|>", "content": "<image>\nFree OCR.", "images": ["<path>"]}, {"role": "<|Assistant|>", "content": "<text>"}]}

PaddleOCR-VL (prompt OCR:):

{"images": ["<path>"], "messages": [{"role": "user", "content": [{"type": "text", "text": "OCR:"}, {"type": "image", "image": "<path>"}]}, {"role": "assistant", "content": [{"type": "text", "text": "<text>"}]}]}

Conversion script:

import json, os
from datasets import load_dataset

ds = load_dataset("CADT-IDRI/KhmerEduDoc")

def export(split, fmt, out_dir):
    os.makedirs(f"{out_dir}/images/{split}", exist_ok=True)
    with open(f"{out_dir}/{split}.jsonl", "w", encoding="utf-8") as f:
        for i, row in enumerate(ds[split]):
            path = f"{out_dir}/images/{split}/{i}.png"
            row["image"].save(path)
            if fmt == "deepseek":
                ex = {"messages": [
                    {"role": "<|User|>", "content": "<image>\nFree OCR.", "images": [path]},
                    {"role": "<|Assistant|>", "content": row["text"]}]}
            else:  # paddle
                ex = {"images": [path], "messages": [
                    {"role": "user", "content": [
                        {"type": "text", "text": "OCR:"},
                        {"type": "image", "image": path}]},
                    {"role": "assistant", "content": [
                        {"type": "text", "text": row["text"]}]}]}
            f.write(json.dumps(ex, ensure_ascii=False) + "\n")

export("train", "deepseek", "deepseek_data")
export("train", "paddle", "paddle_data")

Transcription format

The teacher was prompted to output plain reading-order text. Tables are serialized as HTML. Math is serialized as LaTeX. Khmer diacritics, subscripts and English text are kept as they appear, with no translation. Decorative elements, figures, tables of contents with dot leaders, and author/committee lists are omitted, so some pages may have empty or short transcriptions.

Evaluation sets

  • Set A (60 images): pages from the 4,407-book corpus, disjoint from the release. 50 contain Khmer text only and 10 also contain mathematical content. The teacher draft was corrected at the character level by one native Khmer-speaking annotator.
  • Set B (100 images): older documents from the public collection 5000-years.org. In the books inspected, publication dates range from 1952 to 2003. The teacher draft was corrected by one native Khmer-speaking annotator.

Fine-tuned results (CER, %):

Model Set A (text) Set A (LaTeX) Set B
DeepSeek-OCR-2 (LoRA) 16.39 45.02 37.97
PaddleOCR-VL (LoRA) 10.02 10.78 24.41

Limitations

  • All training labels come from a single teacher model (Gemini 3.7 Flash), so its systematic errors are inherited. The released training and validation labels were not audited against the images at scale.
  • The evaluation references were corrected from teacher drafts by a single annotator. No inter-annotator agreement is available, and anchoring to the teacher is possible.
  • The evaluation sets are small (60 and 100 images), and the 10-image LaTeX subset is indicative only.
Downloads last month
338

Models trained or fine-tuned on CADT-IDRI/KhmerEduDoc