Folio Finland Swedish newspaper OCR
Read a cropped line of historical Swedish print from Finland, or supply a newspaper scan and its PAGE XML line polygons. The default 1.33 MB ONNX model runs on CPU. On 898 lines from nine held-out newspaper titles it made 411 character edits against 38,644 reference characters (1.06% CER). The Swedish variable-height parent scored 5.47% on the same crops.
Read a line
Download the runtime, example and weights with the Hugging Face CLI. Use Python 3.10 or 3.11 for the commands below.
hf download foliokestrel/folio-finland-swedish-newspaper-ocr config.json model.onnx folio_fraktur.py read_page_lines.py requirements.txt examples/line.png examples/source.json --local-dir finland-swedish
cd finland-swedish
python -m pip install -r requirements.txt
python folio_fraktur.py examples/line.png
The example is an archive line from the development set, selected by hashing the line ID. The compact model reads
sade: „Se människan"! Men folket kände
The archive transcription is “sade: „Se människan"! Men folket kände”. The original page, polygon, reference and output are recorded in the example metadata.
To read the 73 lines on the original newspaper page from 16 March 1899, download the optional example into the same directory and run the PAGE reader. This TIFF and its PAGE file differ in declared dimensions. The published polygons have been verified in native scan coordinates. For your own scans, supply the matching PAGE 2013 or 2019 XML file.
hf download foliokestrel/folio-finland-swedish-newspaper-ocr examples/newspaper.xml examples/newspaper.tif --local-dir .
python read_page_lines.py examples/newspaper.xml examples/newspaper.tif --native-coordinates --output readings.jsonl
Each JSON record carries the region and line IDs, polygon, source hashes, original text alternatives and the new folio_swedish reading. Supply a new output filename. When you have verified that the PAGE polygon coordinates refer directly to scan pixels despite a dimension discrepancy, add --native-coordinates to clip polygons at the scan boundary. Line detection, reading order reconstruction, handwriting and modern Swedish spelling are outside the evaluated task. The line recognizer decodes characters greedily, including historical spelling and punctuation. Proofread before quoting.
Evaluation
Both panels use the same reference normalization (Unicode NFC and collapsed whitespace). CER and word error rate (WER) divide total edit distance by total reference length. Macro CER gives each publication equal weight. Exact is the number of matching lines. The two score files give counts for every reader and title. Their folders also include the reference and predicted text for each line. Held-out scores · Official validation scores · Rescoring script
| Reader | Held-out CER | Macro CER | WER | Exact / 898 | Official CER | Macro CER | WER | Exact / 1,410 |
|---|---|---|---|---|---|---|---|---|
| Finland Swedish compact | 1.06% | 0.85% | 5.09% | 725 | 8.61% | 7.47% | 24.55% | 655 |
| Finland Swedish FP32 | 1.07% | 0.86% | 5.13% | 721 | 8.61% | 7.46% | 24.69% | 651 |
| Swedish variable-height | 5.47% | 5.29% | 27.88% | 138 | 9.41% | 8.49% | 32.58% | 364 |
| Swedish page crops | 5.42% | 5.25% | 27.68% | 139 | 9.69% | 8.58% | 33.04% | 360 |
| Folio Finnish | 3.32% | 3.01% | 16.73% | 364 | 11.75% | 9.17% | 36.21% | 386 |
| Tesseract Swedish, single line | 14.24% | 13.53% | 49.52% | 35 | 12.75% | 17.81% | 40.80% | 338 |
| Tesseract Swedish, raw line | 13.78% | 13.31% | 49.87% | 37 | 15.72% | 22.68% | 46.03% | 294 |
| Tesseract frak2021, single line | 10.01% | 9.55% | 37.50% | 85 | 11.06% | 13.02% | 37.56% | 274 |
| Tesseract frak2021, raw line | 9.10% | 8.88% | 37.01% | 85 | 15.83% | 15.22% | 47.00% | 185 |
The held-out panel uses 15 pages from nine titles in the NewsEye training ZIP. Epoch 7 was frozen on development data before test inference. The compact model improved on 9 of nine titles relative to the compact variable-height parent. Each score is conditional on the supplied line polygons.
| Held-out title ID | Lines | Finland Swedish CER | Swedish parent CER | Finnish CER |
|---|---|---|---|---|
| 1238-5743 | 192 | 0.67% | 5.20% | 1.85% |
| 1457-4276 | 96 | 0.90% | 5.08% | 2.25% |
| 1457-4799 | 90 | 4.05% | 8.10% | 9.50% |
| fk00207 | 69 | 0.48% | 5.66% | 2.28% |
| fk00989 | 70 | 0.19% | 4.50% | 2.29% |
| fk00996 | 25 | 0.24% | 5.02% | 2.27% |
| fk01147 | 120 | 0.17% | 4.61% | 1.89% |
| fk09600 | 96 | 0.30% | 4.07% | 2.02% |
| fk14864 | 140 | 0.68% | 5.40% | 2.75% |
The official validation ZIP contributes a separate transfer panel. Its six pages had been examined in earlier reader studies. Two pages from the same title contribute 1,089 of the 1,410 lines, so its pooled CER gives that title substantial weight.
| Official scan | Lines | Finland Swedish CER | Swedish parent CER | Finnish CER |
|---|---|---|---|---|
| 0356-0694_1899-03-16_6_11-gt2 | 73 | 0.04% | 5.24% | 1.10% |
| 0356-0724_1876_11_22_pr-00003 | 435 | 4.59% | 6.15% | 6.61% |
| 0356-0724_1909_01_22_pr-00001 | 654 | 14.48% | 13.57% | 19.95% |
| 0785-398X_1842-10-19_82_1-gt2 | 77 | 1.13% | 5.81% | 2.82% |
| 1458-0683_1886-12-24_299_7-gt2 | 126 | 0.57% | 5.50% | 1.66% |
| fk01706_1847-01-02_1_8-gt2 | 45 | 25.53% | 15.63% | 26.24% |
Character error increased on the 1909 scan (13.57% to 14.48%) and on the 1847 scan (15.63% to 25.53%). On the 1847 page, 35 reference lines contain a run of at least three periods, optionally separated by spaces. The compact model retained such a run on 0 lines and its Swedish parent on 34. Proofread dotted leaders when transcribing an index or contents page.
Transfer to newspapers printed in Sweden
We also compared the frozen compact readers on the original line rectangles of two previously studied collections from Sweden. The page images and ground truth were distributed by Språkbanken Text. We retained each JPEG hash, rectangle and paired reading in the evaluation files. These panels were used only to describe transfer after the Finland checkpoint was frozen. 1818–1870 source · 1871–1906 source
| Collection | Lines | Finland Swedish CER | Swedish parent CER |
|---|---|---|---|
| 1818–1870 | 2,888 | 8.07% | 4.61% |
| 1871–1906 | 624 | 10.10% | 8.63% |
Weights, training and attribution
The compact file stores 18 tensors in int8 and dequantizes for floating-point inference. Full-precision ONNX lives in fp32/. During export, CPU FP32 ONNX agreed with single-line PyTorch on all 860 development readings. Compact and FP32 agreed exactly on 847. The root safetensors contain the selected PyTorch weights.
Folio Kestrel adapted the Swedish variable-height reader on 4,413 lines from 36 titles. Its alphabet retains the prior character IDs and adds 16 symbols observed in training. The training archive was split by publication after excluding known Finnish-parent training titles and rasters and the separate official validation titles and rasters. All selected crop pixel hashes were deduplicated. The development split contains 860 lines on 14 pages from nine other titles. The exact initializer, manifests, source checksums, training history and rebuild instructions are included.
Guenter Muehlberger and Guenter Hackl published the NewsEye / READ Swedish newspaper images and PAGE transcriptions from the National Library of Finland under CC BY 4.0. Weights are CC BY-SA 4.0, code is Apache-2.0, and the example, metadata and evaluation records are CC BY 4.0. Source archive · Full credits and inherited sources