kz_benchmark_data / README.md
Omar-2002's picture
Add files using upload-large-folder tool
881fad5 verified
|
Raw History Blame Contribute Delete
9.61 kB
---
license: cc-by-4.0
pretty_name: Kazakh Real-Document OCR Benchmark
language:
- kk
- ru
task_categories:
- image-to-text
tags:
- ocr
- handwriting-recognition
- document-understanding
- kazakh
- cyrillic
- benchmark
size_categories:
- 1K<n<10K
configs:
- config_name: handwritten
data_files:
- split: test
path: real_handwritten_data/data.csv
- config_name: non_handwritten
data_files:
- split: test
path: real_non_handwritten_data/data.csv
---
# Kazakh Real-Document OCR Benchmark
A test-only benchmark for full-page OCR on real Kazakh documents. It has two subsets:
| Subset | Pages | Size | Text characters | Median chars / page | Max chars / page |
|---|---:|---:|---:|---:|---:|
| `handwritten` | 150 | 100 MB | 89,671 | 542 | 1,665 |
| `non_handwritten` | 1,429 | 321 MB | 836,742 | 428 | 14,336¹ |
| **Total** | **1,579** | **~421 MB** | **926,413** | | |
¹ This page's reference is mostly underscores (13,051 of 14,336 characters) copied
from blank form lines. See "Known limitations".
Each page has one plain-text transcription of the whole page. There are no
bounding boxes, line-level crops or layout annotations.
## Contents
### `handwritten`: 150 pages
Photos and scans of handwritten pages, such as school notebooks, homework, essays,
poems and lecture notes. All pages are **Kazakh**: every page contains
Kazakh-specific letters (ә, ғ, қ, ң, ө, ұ, ү, һ, і). A few pages also contain
digits, arithmetic and simple formulas, and two are lecture notes that quote
code (MPI/OpenMP).
### `non_handwritten`: 1,429 pages
Printed and digital Kazakh documents, including official letters and certificates
(«АНЫҚТАМА»), forms and templates, school worksheets and textbook pages, tables,
and screenshots. 1,419 of the 1,429 pages contain Kazakh-specific letters. Some
pages also include Russian or English text, such as UI labels.
### Images
- All files use the `.jpg` extension. In the non-handwritten subset, 20 of them
are actually encoded in another format: 15 WebP, 3 PNG, 1 BMP and 1 MPO.
Open images with a library that detects the format from the file contents,
such as Pillow, rather than trusting the extension.
- Resolution varies widely (sizes sorted by pixel count):
- handwritten: median 2480 × 3507 px, smallest 240 × 427 px, largest
3120 × 4160 px
- non-handwritten: median 1152 × 648 px, smallest 514 × 122 px, largest
5472 × 3648 px
- Colour modes in the non-handwritten subset: 1,401 RGB, 24 grayscale, 2 CMYK,
2 RGBA. Convert to RGB before inference.
## File layout
```
real_handwritten_data/
data.csv # columns: image_path, text
images/0001.jpg … 0150.jpg
real_non_handwritten_data/
data.csv # columns: image_path, text
images/0001.jpg … 1429.jpg
```
`data.csv` is UTF-8 with every field quoted. `image_path` is relative to the
subset folder, for example `images/0001.jpg`. `text` is the reference
transcription and keeps the page's line breaks. A few references are a single
line (handwritten page `0042` and 35 short non-handwritten pages). Every image
has exactly one row, and no row is empty.
## Usage
The CSVs store image paths rather than embedded images, so the most reliable way
to load the benchmark is to download the repository and read the files directly:
```python
import csv, os
from huggingface_hub import snapshot_download
from PIL import Image
root = snapshot_download("Omar-2002/kz_benchmark_data", repo_type="dataset")
def load(subset): # "real_handwritten_data" or "real_non_handwritten_data"
base = os.path.join(root, subset)
with open(os.path.join(base, "data.csv"), encoding="utf-8") as f:
for row in csv.DictReader(f):
yield Image.open(os.path.join(base, row["image_path"])).convert("RGB"), row["text"]
for image, reference in load("real_handwritten_data"):
...
```
`load_dataset("Omar-2002/kz_benchmark_data", "handwritten")` also works, but it
returns `image_path` as a string, not as a decoded image.
## Evaluation
We recommend reporting **CER** and **WER** (character and word error rate,
computed from Levenshtein distance) separately for each subset, at two levels:
- **corpus-level**: total edits divided by total reference length
- **per-page mean**
Results depend heavily on scoring choices, so state them alongside your numbers:
- **Text normalisation.** Say whether whitespace is collapsed, whether punctuation
and case are kept, and how Markdown/HTML in model output is stripped. Models that
emit Markdown tables or LaTeX are penalised under a plain-text reference unless
their output is converted first.
- **Runaway generations.** VLM-based OCR models sometimes loop until they hit the
token limit, which can produce per-page error rates of several thousand percent.
A few such pages can dominate an uncapped average. We suggest capping per-page
rates at 100% and reporting the number of runaway pages as a separate column.
- **Confidence intervals.** The handwritten subset is small (150 pages), so
differences of a few CER points between models may not be significant. A paired
bootstrap over pages is a simple way to check.
## Known limitations
- **Reference quality is uneven.** The references were produced with the help of
vision-language models and have not all been verified by a human (see Source
data). An automated scan of the labels found:
- **handwritten:** no Markdown, HTML, meta-commentary or repetition loops. Two
pages contain Greek letters (π, α) that are legitimate symbols in formulas.
- **non_handwritten:**
- 46 pages contain English annotations written by a VLM rather than text
printed on the page. Most are seal or stamp markers, such as
`[Seal text]` and `[Text on the seal]`, and others describe the layout, such as
`**Left Side:**`, `**Image 1 (Left):**` and `[Modal window]`.
- 30 pages contain Markdown tables, and 43 contain Markdown `**bold**`.
- 5 pages contain HTML `<br>` tags.
- 7 pages have long runs of filler characters (underscores, dashes, non-breaking
spaces or table separators) copied from form lines. These pages are
`0031`, `0093`, `0206`, `0917`, `1030`, `1046` and `1080`.
- 3 pairs of pages have identical references: `0003`/`0007`, `0368`/`0390`
and `0749`/`0753`. The image files differ, so these are probably the same
page photographed twice.
- 5 pages contain non-Cyrillic, non-Latin characters (Greek, Arabic, CJK).
Some of these are legitimate symbols.
Strip Markdown/HTML from both the reference and the prediction before scoring,
or score tables separately. Treat scores as approximate, especially small
differences between strong models.
- **Reading order is ambiguous** on multi-column pages, tables, two-page spreads
and screenshots. A model can read every word correctly and still get a high
CER/WER if it chooses a different order.
- **Possible overlap with web data.** The pages were collected from the public
web, so some of them may also appear in web-scraped training corpora.
## Source data
- **Handwritten:**
- pages `0001`–`0150`: collected by the author from public web image search.
- **Non-handwritten:** collected by the author from public web image search
using Kazakh queries for document types (certificates, letters, forms,
worksheets, screenshots), then filtered for readable pages.
- **How the references were produced:**
- handwritten, pages `0001`–`0030`: drafted by a vision-language model, then
corrected by hand.
- handwritten, pages `0031`–`0150`: first-pass transcriptions generated by a
vision-language model were re-read against the image by Gemini, which
corrected misread words and restored the page's line breaks
(`gemini-3.5-flash-lite` for 95 pages, `gemini-3.6-flash` for 12,
`gemini-3.7-flash` for 12). The edits are small: the corrected text is
94–106% of the first pass's length. Page `0042` still has its first-pass
transcription, which is a single line without line breaks.
The corrected transcriptions were then checked by a human. Because of time
constraints, some pages may still contain small errors.
- non-handwritten: generated by a vision-language model and not verified by
a human. The Markdown tables and English annotations described under
"Known limitations" come from this.
## Personal and sensitive information
Some pages are official documents, certificates, forms or student work, and may
contain names, signatures, ID numbers, addresses, e-mail addresses or phone
numbers. Personal identification numbers (IINs) were removed from the
transcriptions and blacked out in the images. The images were not otherwise
anonymised.
If you find a page that should not be public, please open a discussion on this
repository and it will be removed.
## Licensing
The annotations (`data.csv` files), the benchmark selection and this card are
released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
The images were collected from the web, and their copyright belongs to the
original publishers or authors. CC BY 4.0 does not cover them. They are shared
here only for non-commercial research evaluation. Rights holders can ask for
removal through the repository's discussion tab.
## Citation
If you use this benchmark, please cite it:
```bibtex
@misc{polat2026kazakhocr,
title = {Kazakh Real-Document OCR Benchmark},
author = {Omar Polat},
year = {2026},
url = {https://huggingface.co/datasets/Omar-2002/kz_benchmark_data}
}
```