vrashad's picture
Upload README.md with huggingface_hub
15b0ad6 verified
---
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/)