File size: 3,543 Bytes
c7d0f4c
 
15b0ad6
c7d0f4c
 
15b0ad6
c7d0f4c
15b0ad6
 
 
 
 
c7d0f4c
b474fd5
15b0ad6
 
 
 
 
 
 
 
c7d0f4c
 
 
 
15b0ad6
c7d0f4c
15b0ad6
c7d0f4c
15b0ad6
c7d0f4c
15b0ad6
c7d0f4c
15b0ad6
 
 
c7d0f4c
15b0ad6
c7d0f4c
 
 
15b0ad6
 
 
 
 
c7d0f4c
 
 
15b0ad6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c7d0f4c
15b0ad6
 
 
 
 
 
 
 
 
 
 
c7d0f4c
 
15b0ad6
 
 
 
 
 
 
 
 
 
 
 
 
c7d0f4c
 
15b0ad6
 
 
 
 
 
 
 
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
---

language:
  - az
license: cc-by-4.0
task_categories:
  - image-to-text
tags:
  - htr
  - handwritten-text-recognition
  - azerbaijani
  - ocr
  - benchmark
pretty_name: Azerbaijani Handwritten OCR Benchmark
configs:
  - config_name: lines
    data_files:
      - split: test
        path: lines/test-*
  - config_name: pages
    data_files:
      - split: test
        path: pages/test-*
---


# Azerbaijani Handwritten OCR Benchmark

A manually annotated benchmark for handwritten text recognition (HTR) on Azerbaijani Latin script. Real-world scanned pages annotated in Label Studio with rotated bounding boxes and exact transcriptions.

Provided in two parallel views:

## `lines` — Line-level recognition

Cropped images of single text lines paired with their transcription. Rotated regions are deskewed (warped to be axis-aligned) so each crop shows the line horizontally.

- **Total lines:** 442
- **Source pages:** 29
- **Avg lines per page:** 15.2

Schema:

| Field | Type | Description |
|---|---|---|
| `image` | Image | Cropped (and deskewed if rotated) line image |
| `text` | string | Ground truth transcription |
| `page_id` | string | Source page identifier |
| `line_id` | int | Line index within page |
| `source_image` | string | Original scan filename |

```python

from datasets import load_dataset

ds = load_dataset("LocalDoc/azerbaijani-htr-benchmark", "lines", split="test")

print(ds[0])

```

## `pages` — Full-page with structured annotations

Original scanned pages with axis-aligned bounding boxes (computed from the rotated polygons) and transcriptions of all lines.

Schema:

| Field | Type | Description |
|---|---|---|
| `image` | Image | Full page scan |
| `page_id` | string | Page identifier |
| `source_image` | string | Original scan filename |
| `image_width` | int | Width of served image (pixels) |
| `image_height` | int | Height of served image (pixels) |
| `num_lines` | int | Number of annotated lines |
| `lines` | list | Per-line annotations |
| `full_text` | string | All line texts joined with newlines |

```python

from datasets import load_dataset

ds = load_dataset("LocalDoc/azerbaijani-htr-benchmark", "pages", split="test")

sample = ds[0]

print(f"Page {sample['page_id']}: {sample['num_lines']} lines")

# HF stores Sequence(of dict) as dict-of-lists. Iterate by index:

for i in range(sample["num_lines"]):

    line_id = sample["lines"]["line_id"][i]

    bbox = sample["lines"]["bbox"][i]

    text = sample["lines"]["text"][i]

    print(f"  Line {line_id}: bbox={bbox}, text={text}")

```

## Linking between configs

Same `page_id` and `line_id` connect entries across both configs.

## How it was built

1. Real Azerbaijani handwritten pages were collected
2. Uploaded to Label Studio for annotation
3. Each line was manually bounded with a (possibly rotated) rectangle and transcribed
4. For `lines` config: rotated regions are deskewed via affine transform so crops are horizontal
5. For `pages` config: rotated polygons are converted to their axis-aligned bounding boxes
6. Page images optionally downscaled to max 2200px for file size

## Notes

- Transcriptions are **literal** — handwriting errors preserved as written
- Rotated bboxes are handled correctly via perspective transform
- `lines` crops have 4px padding around text
- `pages` bbox coords are in pixels of the served image (after resize)

## License

[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)