TL;DR
This paper introduces a massive, structured dataset of over six million internal migration entries in Finland spanning 1800–1920, automatically extracted from approximately 200,000 handwritten historical church records. The authors developed a modular deep learning pipeline combining advanced layout analysis, table detection, cell classification, and handwritten text recognition (HTR) to convert unstructured archival images into research-ready data. This work provides a powerful blueprint for transforming large-scale historical archives into structured datasets for demographic, epidemiological, and social science research.
What Problem Does This Paper Address?
Historical tabular documents, such as parish registers and migration logs, contain invaluable data for studying long-term demographic trends, urbanization, and the spread of diseases. However, unlocking this data at scale is notoriously difficult.
Unlike modern digital spreadsheets, historical church records suffer from significant structural and textual degradation. Layouts vary wildly across different time periods and parishes—ranging from completely free-form text to hand-drawn grids and inconsistent preprinted forms. Furthermore, the documents are plagued by faded ink, paper wear, diverse handwriting styles, and a lack of explicit structural markers. Standard optical character recognition (OCR) tools fail on these complex, handwritten tabular formats, meaning data extraction has traditionally relied on slow, expensive manual transcription.
Methods
The authors built a multi-stage, automated machine learning pipeline to process the double-page book openings. The workflow is divided into three primary phases:
[Original Image] ➔ [Preprocessing & De-skew] ➔ [Layout Analysis & Table Detection] ➔ [Tabular Text Recognition]
- Preprocessing (De-skewing): Book scans often suffer from severe page rotation. The authors treated de-skewing as a keypoint detection problem, using a two-stage YOLO (You Only Look Once) pose estimation model to locate six critical points on a double-page opening (the four outer corners and the two ends of the center spine). This allows the system to independently de-skew the left and right pages.
- Table Structure Detection: To isolate rows and columns, the pipeline combines YOLO (for detecting entire tables and individual cells) with Mask R-CNN (for pixel-level line segmentation). To fix missing cell boundaries, they applied DBSCAN clustering as a post-processing step to reconstruct the complete grid.
- Cell Type Classification: Before running text recognition, a YOLO-based classifier categorizes cells into four types: single-line, multi-line, repetition (ditto marks), or empty. This prevents the text recognition model from hallucinating content in blank spaces and optimizes processing speed.
- Text & Year Recognition: Text transcription is handled by a TrOCR (Transformer OCR) model fine-tuned by the National Archives of Finland specifically for historical Finnish and Swedish handwriting. For extracting the migration year (which is usually written once at the top of a page rather than on every row), the authors used YOLO to find year mentions and then leveraged GPT-4o-mini to logically infer and correct the chronological sequence of years across pages.
Datasets
The primary source material consists of roughly 200,000 digitized images from 2,781 books across 468 Evangelical-Lutheran parishes, provided by Finland’s Family History Association (FFHA).
To train and evaluate their pipeline components, the authors created a manually annotated gold-standard dataset:
- 1,632 images annotated with table structure data.
- Subsets of these images annotated for de-skew keypoints (1,290 images), cell type classification (77,000 cells), text recognition (4,224 cells), and year recognition (1,326 images).
The final extracted dataset, containing over 6 million migration records, has been made openly available on Zenodo.
Key Insights and Ideas
- Two-Stage Keypoint Detection is Crucial for Books: Trying to find precise page corners globally on a full-resolution image is inaccurate. By first finding the approximate vicinity of the corners (Stage I) and then zooming in on a 15% bounding box to find the exact pixel location (Stage II), the de-skewing error dropped dramatically.
- Clustering Heals Broken Grids: Hand-drawn tables often have faint or missing lines. Using density-based clustering (DBSCAN) on the detected cell borders allows the algorithm to "fill in the gaps" and infer missing cells logically.
- LLMs Excel at Sequential Post-Correction: Historical records are noisy, but they follow strict logical constraints (e.g., years must move forward chronologically). Using an LLM to look at the surrounding context of pages proved highly effective at correcting OCR hallucinations in year detection.
Key Results
The pipeline was deployed on a supercomputer using NVIDIA V100 GPUs, processing the entire 200,000-image archive in just four days (averaging 60 seconds per image).
- Table & Layout Detection: The model achieved an F1-score of 97.0% for table detection, 95.5% for row detection, and 97.1% for column detection. It performed slightly better on hand-drawn pages than preprinted ones due to fewer multi-table layout complications.
- Text Recognition: The TrOCR model achieved a Character Error Rate (CER) of 0.19. The Exact Match (EM) rate was 65.8% for numeric lines (dates, page numbers) but lower (28.2%) for longer textual lines (names, occupations), which are inherently harder to transcribe perfectly without a single character error.
- Year Extraction: Combining HTR with GPT-4o-mini post-correction pushed the year extraction F1-score to 87.2% (up from 84.4% without the LLM).
Limitations and Future Work
Despite its success, the authors noted several areas for improvement. In 48% of the test images, the pipeline introduced layout errors, such as miscounting columns or splitting a single double-page table into two separate tables.
Additionally, historical place names remain a major hurdle for automated normalization. Due to phonetic spellings by Swedish-speaking clerks writing Finnish names, only 8% of extracted parish names could be directly matched to an official parish list using simple edit distance.
Future work will focus on developing LLM-based post-processing tools to infer column headers when they aren't explicitly captured, normalize spelling variations in names and places, and use chronological context to reconstruct missing dates.
Summary updated