How an AI Model Reads the Layout of a Scanned Page

See how an AI model locates text and tables, then check its proposed crop against an 1880 census sheet before sending it to text recognition.

An overhead camera faces an open ledger supported by a book cradle.
On a complete page, the margins, headings and ruled lines give the AI model clues about where entries begin and end.

We tested Heron, an AI model that identifies parts of a page, on the 1880 census sheet that lists Laura Ingalls at age thirteen. Its strongest prediction outlined almost exactly the part a researcher would want to read. The label it assigned was picture. A digitization system that skips pictures when extracting text could lose the entire household even though every name is visible in the scan.

What the model saw in the De Smet census

A layout detector looks at a page image and proposes rectangles with labels such as text, table or picture. We ran the Docling project’s Heron detector on the full page image embedded in the National Archives PDF. The English instructions, the enumerator’s handwriting and the ruled grid were all part of the same input. We kept raw detections with scores of at least 0.50. The strongest was a picture at 0.856. None of the retained boxes carried a table label. Docling’s Heron model and ONNX release.

A red outline follows the ruled grid from its column headings to the last household, leaving the place and page number above it.
Yenra added the outline of the highest-scoring prediction to the actual 1880 federal census image. The location is plausible. The label would send the grid down the wrong processing path. Inspect the unmarked page.

Read across one line yourself. The vertical rules separate the name, age, relationship and occupation. Read down the name column and you find a surname written once with dashes beneath it. Someone transcribing this region needs both directions. Even a perfect box around the grid would leave the work of assigning words to rows and columns.

Where a model gets its idea of a table

People draw boxes around examples and assign region types. During training, the detector adjusts its predictions to bring both the box and class closer to those annotations. A modern report may place a caption beside a clean table on white paper. On microfilm, a ruled census schedule can occupy almost the whole page, with handwriting crossing the lines. The historical page asks the model to recognize a familiar function in an unfamiliar visual form.

A reader studies a page divided into regions on a large monitor.
A layout detector proposes boundaries and labels. The reviewer decides which regions contain records worth extracting.

The DocLayNet research team published 80,863 human-annotated pages with eleven layout classes and compared detectors trained on different collections. Models trained on more varied layouts generalized better in their comparisons. This is evidence about training diversity. The De Smet result above comes from our separate Heron test. An archive can evaluate its own collection by checking whether a predicted box encloses the right content and assigns the class required for the next step. DocLayNet dataset and detector experiments.

Keep what the crop leaves out

The original sheet has a handwritten locality, an enumeration district and a large 146 at the top right. The household sits far below. Preserve the full page and neighboring pages in their source order before making a crop for recognition. A crop of an individual line can cut off the surname or a number needed to retrieve the sheet later. If the paper itself is being photographed, check edges, the fold near a binding and fine strokes at full resolution. FADGI’s guidance pairs capture targets with testing and monitoring. Federal digitization guidance for still images.

Two worn, discolored paper surfaces appear side by side.
Keep the source image and create a working copy for contrast adjustments. Faint strokes can disappear under aggressive cleanup.

For this example, a useful reference is the 1880 U.S. population census, Dakota Territory, De Smet, enumeration district 87, T9 roll 113, page 146A. Keep that alongside the source URL, local file identifier, page order, crop coordinates and any rotation applied. Store the untouched source and make separate files for deskewing, contrast changes and model output. A second reader can then recover where an entry sat even after the search index changes. National Archives collection notes and original schedules.

Decide which regions reach the recognizer

On this sheet, the practical correction is to retain the box around the grid, mark it for table and handwriting review, and send the printed heading to a print recognizer. Keep the model’s original label beside the reviewer’s correction. If more pages from this volume receive the same label, check a sample before applying the correction in bulk. Compare pages from different enumerators, including faint exposures and continuations without a full heading.

An archival form fills a monitor beside papers on a desk.
Link an extracted field to a page and location so a reader can inspect the marks that supplied it.

Inspect a sample of regions that the system would discard as well as the ones it accepts. Count missing tables, incorrect labels and crops that cut off writing. Each requires a different remedy. To see what happens once a good crop reaches recognition, compare two machine readings of the printed census heading. The household comparison shows why preserving the surrounding rows mattered.

Illustrated field notes

From an image to lines of text
A portrait and a page of handwritten entries appear on an archive workstation.
A recognition result is much easier to audit when the record opens on the source page.
A stylized scanner glows above a page on a dark work surface.
Printed headings and handwritten entries can need different recognition models even on the same sheet.
A hand writes in a densely filled open ledger.
A name can borrow its surname from a line above. Include neighboring lines when preparing an extraction region.
Classifying, correcting and describing a file
Tall racks of illuminated files line an archive aisle.
Document classification assigns a category to a file. Verify a sample from each category before routing the rest automatically.
A pen rests across lines of a printed form.
Check whether a proposed correction changes a letter, a row boundary or the association between a heading and its values.
Two readers study a book in a blue-lit library.
Descriptive metadata can be proposed automatically. A collection identifier and a page reference make each suggestion traceable.
An illustrated figure faces a series of connected workflow symbols.
Save a review decision beside the model and input version so later processing can reproduce or revise it.