Folio Finnish Newspaper OCR
Transcribe lines of historical Finnish print on a CPU. Give the reader a cropped line, a scan with PAGE XML line polygons, or a newspaper scan with no layout. The download includes the Finnish line reader and an optional line detector. Inference runs locally.
On 1,639 lines from 18 held-out publications, the Finnish reader made 402 edits in 62,145 reference characters (0.65% CER). Its parent made 1,666 edits (2.68%). Both saw the same line crops. Starting from a whole scan introduces additional errors from finding the lines. Test scores by publication · Whole-scan measurements
Read a Finnish newspaper
Use Python 3.10 or newer. Download the repository once, then run these commands from its directory.
python -m pip install huggingface_hub
hf download foliokestrel/folio-finnish-newspaper-ocr --local-dir finnish-ocr
cd finnish-ocr
python -m pip install -r requirements.txt
python folio_fraktur.py examples/line.png
The reader returns this line from a 1910 scan.
33 milj. r. Posti- ja sähkölennätinlaitosta käytetään Venäjällä
If you have PAGE line polygons, this command masks out adjacent print and writes the text with its source region and line IDs. The bundled XML has its transcriptions removed. Example source and crop
python read_page.py examples/layout.xml --output transcriptions.tsv
For a scan without line coordinates, run the detector and reader together. JSON includes a text string and a half-open pixel rectangle [left, top, right, bottom] for each detection. PAGE XML uses the same lines. Both commands require a new output file. The detector handles horizontal print. Multi-column articles may need reading-order reconstruction.
python read_scan.py examples/scan.tif --output lines.json
python read_scan.py examples/scan.tif --format page --output lines.xml
Käyttö suomeksi
Malli tunnistaa historiallisten suomalaisten sanomalehtien painettua tekstiä. Jos aineistossasi on valmiit rivirajaukset PAGE XML -muodossa, käytä komentoa read_page.py. Pelkän sivukuvan voit käsitellä komennolla read_scan.py. Saat jokaiselle havaitulle riville tekstin ja sijainnin alkuperäisessä kuvassa. Tarkista monipalstaisen sivun lukujärjestys ennen kuin yhdistät rivit artikkeliksi.
Accuracy on known lines
Character error rate (CER) is total character insertions, deletions and substitutions divided by the reference character count, after NFC normalization and whitespace collapse. The test spans 26 pages from 18 publication IDs reserved before training. The official panel has eight other publication IDs and was used in earlier reader comparisons. All six settings read identical original-resolution polygon crops. Test predictions · Official-panel predictions
| Reader | Held-out CER | Official panel CER |
|---|---|---|
| Folio Finnish Newspaper OCR | 0.65% | 2.02% |
| Folio Mixed, Austrian/Luxembourg parent | 2.68% | 7.32% |
| Mannheim frak2021, single-line | 6.29% | 5.45% |
| Mannheim frak2021, raw-line | 6.23% | 7.40% |
| Tesseract Finnish tessdata_best, single-line | 15.41% | 7.55% |
| Tesseract Finnish tessdata_best, raw-line | 16.35% | 8.18% |
The Finnish reader returned the exact normalized reference on 1,453 of 1,639 held-out lines. Its mean CER across the 18 publication IDs was 0.81%. On held-out publication fk00636, Finnish tessdata_best single-line had lower CER (1.63% versus 2.58%). On the official page marked Antiqua, the same baseline achieved 1.67% versus 4.30%. These trials cover printed Finnish and the listed baselines. External readers' original training overlap is unknown. Per-page results
Accuracy from full scans
On the eight untouched official rasters, automatic Folio layout found 2,847 candidate lines. Of 2,631 annotated lines, 2,478 matched a detection at intersection-over-union of at least 0.5. On matched pairs, CER was 2.56%. Counting missed reference characters and characters on extra detections brought the error to 11.29%. The parent reader on the same boxes scored 13.17% on that measure. Native Mannheim and Finnish Tesseract in automatic page mode scored 15.78% and 17.76%. These scores evaluate text and line localization. Reading order is outside the measurement. Counts, page results and scoring procedure
Training and verification
This 1.31M-parameter convolutional/recurrent CTC reader was initialized from Folio Mixed and adapted on 13,977 usable lines from 110 Finnish publications. Its vocabulary contains 164 symbols plus the CTC blank. Selection used mean CER across 18 separate development publication IDs. The CPU ONNX reader reproduced all 1,659 selected-checkpoint development readings. Rebuilding the held-out and official inputs from their scans and PAGE files reproduced all 4,270 scored strings through the supplied PAGE command. Training recipe · CPU export check · PAGE replay
Recognition weights use CC BY-SA 4.0. The bundled layout weights, Finnish scans and derived evaluation data use CC BY 4.0. The code uses Apache 2.0. Credits and licenses