abhishekjha1008's picture
Attribute source text to DiEm (Rigsarkivet, CC-BY-4.0); correct splits (all-train by design) and diacritic note; link generation code
e985037 verified
|
Raw History Blame Contribute Delete
7.2 kB
---
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)