Folio Fraktur Line
Transcribe a cropped line of historical German print on a CPU. The 5.20 MB ONNX model returns Unicode text and preserves characters such as long ſ. It was trained on normalized line images from the Deutsches Textarchiv (DTA). Each input should contain one horizontal printed line, cropped close to the text, with dark ink on a light background.
On 1,344 DTA lines from seven authors held out of training and validation, the reader made 384 edits in 52,045 characters (0.74%). Tesseract’s Fraktur model made 3,376 (6.49%). On line crops from two Swiss scans the ordering reversed, with 27.18% character error for this reader and 5.93% for Tesseract. For a new collection, compare both readers on a small transcription sample before processing the collection.
Read a line offline
Install the dependencies and download the runtime files once. The reader then runs locally with no service or API key. The CLI accepts one or more image paths and writes one transcription per image, in order.
python -m pip install huggingface_hub
hf download foliokestrel/folio-fraktur-line model.onnx config.json folio_fraktur.py requirements.txt examples/dta-line.png --local-dir folio-fraktur-line
cd folio-fraktur-line
python -m pip install -r requirements.txt
python folio_fraktur.py examples/dta-line.png

heiteren Gedanken auf meinem Poſten. Das
The image and transcription come from Gottfried Keller’s Der grüne Heinrich (1854), DTA validation line 08925. For a search index that treats both forms of s alike, store the diplomatic output and derive a search string with text.replace("ſ", "s").
Create the reader once when processing many cropped lines.
from PIL import Image
from folio_fraktur import FrakturReader
reader = FrakturReader(threads=2)
with Image.open("examples/dta-line.png") as image:
text = reader(image)
print(text)
Line detection and page layout must be handled upstream. Handwriting, vertical text and other scripts are outside the evaluated use. The repository also contains PyTorch Safetensors weights for training or inspection.
Evaluation
We grouped all works from the same catalogue author together. The reader trained from scratch on 74,248 lines by 24 authors. Five other authors supplied 960 validation lines. Of six training epochs on one H100, epoch five had the lowest validation error. The same validation data selected Tesseract script/Fraktur over deu (3.94% versus 10.69%). We froze the weights, the baseline and the evaluation rules before scoring the seven remaining authors. The corpus was published in 2018. Overlap with Tesseract’s own training data is unknown.
| Held-out DTA author ID | Lines | Folio CER | Tesseract Fraktur CER |
|---|---|---|---|
| boerne | 192 | 0.43% | 4.36% |
| clauren | 192 | 0.38% | 4.87% |
| lenau | 192 | 0.52% | 7.44% |
| menzel | 192 | 0.57% | 5.53% |
| paul | 192 | 0.75% | 8.16% |
| storm | 192 | 1.70% | 7.68% |
| wackenroder | 192 | 1.16% | 8.81% |
| All characters pooled | 1,344 | 0.74% | 6.49% |
The readers transcribed 1,129 and 204 DTA lines exactly, respectively. CER counts Unicode character insertions, deletions and substitutions, including punctuation, after NFC and whitespace normalization. On Wackenroder line 03641, Folio transcribed every word correctly but changed the final period to a question mark. Equal weighting per author gives 0.79% versus 6.69% CER. Full results and per-line predictions
On a two-thread x86-64 CPU run, ONNX took a median 10.2 ms and a 95th percentile of 12.1 ms per held-out line, including preprocessing and decoding with the image already in memory. Both CPU formats produced identical transcriptions across all 1,344 DTA test lines and all 24 Swiss lines. Single-image CPU inference differed from the batched GPU validation output on one of 960 lines, adding one character edit. Runtime measurements
Transfer to scans from two Swiss books
For each book, we sampled 12 complete lines using page geometry and a fixed hash. An AI reader transcribed the 24 crops before seeing any system output or the source OCR. This small panel uses search-oriented text normalization, including folding ſ to s. All three systems were scored against the same references. One reading contains an uncertain glyph.
| Original page crops | Lines | Folio CER | Tesseract Fraktur CER |
|---|---|---|---|
| Junod, 1840 | 12 | 12.44% | 1.58% |
| Wolf, 1873 | 12 | 45.23% | 11.25% |
| Combined | 24 | 27.18% | 5.93% |
Folio reproduced zero full Swiss lines exactly. Tesseract Fraktur reproduced six. Restricting the comparison to the 23 clear references gives 27.81% versus 6.12%. The included Wolf crop shows the failure directly. The print reads “Sie erschien zuerst 1712” near the start of the line, and Folio renders that passage as “erdhien ert UlO”. Both example crops and the raw outputs are included so readers can inspect the mismatch. Wolf crop · Junod crop · Raw Swiss predictions
Training data and license
The Deutsches Textarchiv supplied the DTA19 component of GT4HistOCR, collected by Uwe Springmann, Christian Reul, Stefanie Dipper and Johannes Baiter. Folio Kestrel trained the model, exported the weights and evaluated both readers. The weights are distributed under CC BY-SA 4.0 and the Python code under Apache 2.0. Source attribution, the author split, training code and evaluation instructions are included. GT4HistOCR · Source notices · Reproduce the trial