File size: 7,196 Bytes
8a3613a
 
 
a88748e
 
 
8a3613a
a88748e
 
 
 
 
 
 
8a3613a
a88748e
 
8a3613a
 
a88748e
8a3613a
45b3404
e985037
45b3404
 
25e4510
 
 
 
 
 
a88748e
8a3613a
a88748e
8a3613a
a88748e
8a3613a
a88748e
8a3613a
a88748e
 
 
 
e985037
a88748e
 
 
8a3613a
a88748e
8a3613a
a88748e
 
 
 
 
e985037
8a3613a
a88748e
8a3613a
a88748e
8a3613a
a88748e
 
e985037
 
 
a88748e
e985037
 
 
 
 
 
 
 
 
 
 
a88748e
 
 
 
 
 
 
 
 
e985037
a88748e
 
 
e985037
 
 
 
a88748e
 
 
 
8a3613a
a88748e
 
 
 
8a3613a
a88748e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a3613a
 
e985037
 
a88748e
 
 
 
e985037
a88748e
 
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
---
license: cc-by-4.0
task_categories:
  - image-to-text
language:
  - da
tags:
  - htr
  - handwritten-text-recognition
  - historical
  - danish
  - synthetic
  - ocr
  - document-ai
size_categories:
  - 100K<n<1M
pretty_name: Danish HTR Synthetic (18th-Century)
---

# Danish HTR Synthetic — 18th-Century Handwriting

> 📝 **Blog:** [Segmentation is the hidden tax in historical HTR](https://dev.to/abhipandit1/segmentation-is-the-hidden-tax-in-historical-htr-1i67)
> 🛠️ **Generation code:** [github.com/AbhiPandit1/danish-htr-synthetic → `generator/`](https://github.com/AbhiPandit1/danish-htr-synthetic/tree/master/generator)


<p align="center">
  <img src="https://huggingface.co/datasets/abhishekjha1008/danish-htr-synthetic/resolve/main/assets/dataset_demo.gif" alt="Synthetic Danish line images with exact ground truth" width="600" />
</p>
<p align="center"><em>Each synthetic line image is paired with its exact ground-truth transcription.</em></p>


**160,000 synthetic handwritten-text-line images with perfect ground truth, for training and pretraining historical Danish handwriting recognition (HTR) models.**

Historical HTR is data-starved: for most languages and eras there is too little *corrected* handwriting to train a recogniser directly. This dataset is a synthetic bootstrap — clean, perfectly-labelled lines that let a model learn Danish 18th-century letterforms and vocabulary *before* it ever sees scarce, expensive real transcriptions.

---

## What's inside

| | |
|---|---|
| **Lines** | 160,000 |
| **Era** | 18th-century Danish (`1700s`) |
| **Split** | all `train` (by design — see [Splits](#splits)) |
| **Label quality** | Exact — the text is known by construction (no transcription noise) |
| **Format** | Parquet (auto-converted); source images are JPEG |
| **License** | CC-BY 4.0 |

### Features

| Column | Type | Description |
|---|---|---|
| `image` | image (JPEG) | A single rendered handwriting line |
| `text` | string | Ground-truth transcription (3–102 characters) |
| `era_bucket` | string | Period label (`1700s`) |
| `split` | string | `train` for every line in the released set (see Splits) |

---

## How it was generated

Each line pairs authentic-looking period handwriting with realistic capture degradation, so a model trained on it transfers to real scans:

- **Scripts** — historical Danish hands: gothic cursive (*Kurrent*), the everyday administrative hand of the era, and *copperplate* for formal writing. The released generator ships a documented, openly-licensed font set (Kurrent + a Schwabacher face; the OFL faces *Herr Von Muellerhoff* and *Petit Formal Script*).
- **Text** — real 18th-century Danish transcriptions (see [Source & attribution](#source--attribution)), so the model learns the right vocabulary, spelling and letter-combinations of the era.
- **Degradation** — paper texture and tone, ink/stroke-weight variation, blur, noise and simulated bleed-through. In the released code **every line records the font and the exact degradation parameters** used, so individual factors can be isolated for diagnostic study.

The full, deterministic pipeline (rendering, degradation, splitting, manifest) is released under MIT at [`generator/`](https://github.com/AbhiPandit1/danish-htr-synthetic/tree/master/generator). The result is training data with the one thing real historical corpora almost never have: **exact labels at scale.**

---

## Source & attribution

The text is **not invented**. It is drawn from the **DiEm HTR dataset** (*Digitalisering af Enesteministerialbøger*) — the volunteer-verified transcriptions of Danish parish registers released by the **Danish National Archives (Rigsarkivet)** under CC-BY 4.0: [RA-Data-Science/DiEm_HTR](https://huggingface.co/datasets/RA-Data-Science/DiEm_HTR). This dataset re-uses only the text strings, with attribution, under that licence.

Provenance is verifiable: of the 36,056 unique strings here, **39% are verbatim DiEm transcription lines and 71% appear verbatim within a DiEm page**, with **99% of word tokens** present in the DiEm vocabulary (the remainder is the same text re-segmented at different line boundaries).

**Orthography:** the period form *aa* dominates (22% of lines); the modern letter *å* (official only from 1948) appears in only 8 of 160,000 lines (0.005%), where the source transcription itself uses a modernised spelling. Text is rendered as transcribed; the generator has an optional normalisation hook (e.g. `å → aa`), off by default.

---

## Intended use

- **Pretraining / warm-start** a CTC or sequence recogniser (e.g. PyLaia, TrOCR) before fine-tuning on a small set of *real* corrected lines.
- **Data augmentation** to stabilise training on tiny real-world historical corpora.
- **Ablations** on how synthetic volume, degradation and script style affect downstream accuracy.

> **Honest note:** synthetic data is a *bootstrap*, not a substitute for real ground truth. Always report final accuracy on a **held-out set of real documents**, not on synthetic data. Because the text here is drawn from DiEm, your real test set should be held out from the DiEm transcriptions to avoid text leakage.

---

## Splits

The released set labels **every line `train`**: it was built purely as a pre-training / augmentation source, with final accuracy always measured on **held-out real documents** (a synthetic test split is not a meaningful target). If you want explicit, reproducible `train`/`val`/`test` splits, the [generator](https://github.com/AbhiPandit1/danish-htr-synthetic/tree/master/generator) produces them (assigned by hashing the text, so there is no leakage).

## Quick start

```python
from datasets import load_dataset

ds = load_dataset("abhishekjha1008/danish-htr-synthetic")
sample = ds["train"][0]
sample["image"]   # PIL.Image — the handwriting line
sample["text"]    # str      — the ground-truth transcription
```

---

## Why this exists

This dataset is part of ongoing independent research on recognising historical and handwritten text across languages and scripts — building specialist recognisers that stay faithful to the page where general vision-language models tend to hallucinate. Synthetic data like this is how you cold-start a recogniser for a language and era that does not yet have enough labelled real data.

If you use it, I'd genuinely like to hear what you built — feel free to open a discussion on the dataset.

---

## Citation

```bibtex
@misc{jha2026danishhtrsynthetic,
  title        = {Danish HTR Synthetic: 160k Synthetic 18th-Century Danish Handwriting Lines},
  author       = {Jha, Abhishek},
  year         = {2026},
  howpublished = {Hugging Face Datasets},
  url          = {https://huggingface.co/datasets/abhishekjha1008/danish-htr-synthetic}
}
```

Please also credit the source text: the DiEm HTR dataset (Rigsarkivet), CC-BY 4.0.

---

## License & contact

Released under **CC-BY 4.0** — free to use with attribution. Source text © the Danish National Archives (Rigsarkivet) / DiEm contributors, CC-BY 4.0.

**Author:** Abhishek Jha · [GitHub](https://github.com/AbhiPandit1) · [Hugging Face](https://huggingface.co/abhishekjha1008)