UTC02:22:32
LAUSANNE03:22:32
46.5196°N 6.6322°E

Case // 09

OCR pipeline

From a scanned page to searchable text, with a confidence score for every word.

All projects

Fact sheet

A self-contained demonstration of Tesseract 5.4 driven from Python: plain text, word boxes with confidence, page segmentation modes, hOCR and searchable PDFs with an invisible text layer.

Context
R&D lab
Role
Research and development
Team
Solo
Period
2026
Status
Prototype
  • 95%mean word confidence on the sample page
  • 4output formats

Challenge

01

Choose and tune an OCR approach for document digitisation: how reliable is each word, how should a page with columns be segmented, and how do you hand the results to other systems?

Approach

02

A Python script generates its own test pages, then walks through the engine: image_to_string for text, image_to_data for word-level boxes and confidence, a comparison of page segmentation modes on a two-column layout, hOCR export, and a searchable PDF built with reportlab.

Outcome

03

A reusable reference for OCR work, with measured confidence (95% on average on the sample page) and the output formats that downstream systems need.

Architecture

SCHEMA
OCR pipeline: ArchitectureInputEngineOutputsPage imageRendered or scanned pagePillowLoad and prepareTesseract 5.4LSTM engine, PSM modesPlain textimage_to_stringWord dataBoxes and confidencehOCRStructured HTMLSearchable PDFInvisible text layer
One engine, four outputs: each serves a different consumer, from a human reviewer to a search index.
Input
Page imageRendered or scanned page
Engine
PillowLoad and prepare
Tesseract 5.4LSTM engine, PSM modes
Outputs
Plain textimage_to_string
Word dataBoxes and confidence
hOCRStructured HTML
Searchable PDFInvisible text layer

Swipe sideways to explore the diagram

What I did

  • Word-level bounding boxes and confidence, drawn on the page for human review
  • Side-by-side comparison of page segmentation modes on complex layouts
  • hOCR and searchable PDF outputs for archives and search engines
  • LSTM engine with multilingual language packs

Stack

AI
  • Tesseract 5.4 (LSTM)
  • pytesseract
Back end
  • Python
  • Pillow
  • reportlab

Related services

Need something similar? These are the services this project demonstrates.

Get in touch