File size: 9,613 Bytes
e02cdc6
 
881fad5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e02cdc6
881fad5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
---
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}
}
```