OCR & Document Intelligence

OCR & Document Intelligence — Konrad Chmielinski
Engineering Blog · Konrad Chmielinski

Turning unstructured documents into structured, machine-readable data — at enterprise scale.

Document AI ABBYY · Azure · OCR NL / FR / BE / DE & more Katowice, PL · Remote OK

Most enterprise data does not live in neat database tables. It lives in scanned PDFs, faxed contracts, handwritten forms, identity documents, and chemical research reports — formats that no SQL query can touch. Document Intelligence is the engineering discipline of bridging that gap: extracting, validating, and routing information from unstructured sources into systems that can actually use it.

I have built and maintained production document intelligence pipelines across two employers, four Western European markets, and multiple document types. This post covers the full stack — tools, architectures, accuracy patterns, and real project outcomes.

70%
end-to-end accuracy on multi-market identity & PoA docs (ING)
4+
Western European markets covered (NL / FR / BE / DE & more)
2
employers with production OCR deployments
3+
distinct OCR engines used in production

The core challenge

why it is hard

Document intelligence is deceptively difficult. A scanned PDF of a Dutch power of attorney document looks nothing like a Belgian one — different layout, different fonts, different field positions, different languages, and potentially a handwritten signature that must be detected as present or absent. Any pipeline that handles one handles none of the others unless explicitly engineered to do so.

The core pipeline pattern is always the same, but every layer requires deliberate engineering decisions:

Ingest
Classify
OCR / Extract
Validate
Enrich
Route
Store

OCR engines I have used in production

tool comparison
On-premise · batch
ABBYY FlexiCapture
Trained document classifiers, zonal OCR, rule-based field extraction. Best for high-volume structured forms.
Cloud · ML-based
ABBYY Vantage
ML skill training for semi-structured docs. Handles layout variance better than FlexiCapture.
Cloud · Azure
Azure Document Intelligence
Form Recognizer + custom models. Best Azure-native integration, REST API, continuous model retraining.
Cloud · Azure
Azure Computer Vision OCR
Raw text extraction from scanned pages. Used as a fallback or pre-processing step before structured extraction.
EngineBest forLayout varianceDeployment
ABBYY FlexiCaptureHigh-volume structured formsLow toleranceOn-premise / server
ABBYY VantageSemi-structured, variable layoutsMedium toleranceCloud / hybrid
Azure Document IntelligenceAzure-integrated pipelines, APIsHigh toleranceAzure cloud
Azure Computer Vision OCRRaw text extraction, preprocessingVery highAzure cloud

Document classification

before extraction

Before any field can be extracted, the pipeline must know what type of document it is looking at. At ING, I built a classifier that distinguished between power of attorney documents and identity documents across four markets — each with different layouts and languages. The classifier routed documents to the correct extraction model before any OCR ran.

Document classifiersScikit-LearnABBYY FlexiCapture trained models Azure Custom Document ModelsLayout heuristicsLanguage detectionMulti-format routingPDF metadata parsing

Field extraction patterns

the core logic

Extraction strategy depends entirely on document structure. I use three patterns depending on the document type:

Pattern 1
Zonal extraction
Fixed-position fields. Define bounding boxes per document type. Works perfectly for standardised forms.
Pattern 2
Key-value extraction
Label-value pairs. OCR finds “Name:” and extracts the adjacent value. Tolerant of layout shifts.
Pattern 3
ML model extraction
Azure Document Intelligence custom models trained on labelled examples. Best for high-variance layouts.
Pattern 4
LLM-assisted extraction
GPT-4o over OCR text output for complex or ambiguous documents where rules break down.
# Azure Document Intelligence extraction pattern
from azure.ai.formrecognizer import DocumentAnalysisClient
from azure.core.credentials import AzureKeyCredential

client = DocumentAnalysisClient(
  endpoint=“https://your-resource.cognitiveservices.azure.com”,
  credential=AzureKeyCredential(api_key)
)
poller = client.begin_analyze_document(“prebuilt-document”, document)
result = poller.result()

for kv_pair in result.key_value_pairs:
  if kv_pair.key and kv_pair.value:
    fields[kv_pair.key.content] = kv_pair.value.content

Signature detection

beyond text

One of the more unusual requirements at ING was detecting the presence of a handwritten signature on power of attorney documents. A document without a signature is legally invalid and must be rejected before it enters the processing queue. I built a computer vision step using OpenCV and Pillow that analysed pixel density in defined signature zones — a simple but effective binary classifier that ran ahead of the full OCR pipeline.

OpenCVPillow Pixel density analysisBounding box ROIBinary classificationPre-processing gateNumpy array ops

Validation & post-processing

trust but verify

Raw OCR output is never trusted directly. Every extracted field goes through a validation layer — format checks (dates, ID numbers, postcodes), cross-field consistency checks, and confidence score thresholds. Low-confidence extractions are flagged for human review rather than silently passed downstream.

Pydantic validation modelsConfidence score thresholds Regex field validationCross-field consistencyHuman-in-the-loop routingException loggingPandas post-processing
Key principle: a pipeline that silently passes bad data is worse than one that flags it for review. Every production pipeline I build has an explicit exception lane — documents that fall below confidence threshold go to a human queue, not into the database.

Production deployments

employer context
ING Hubs Poland (GKYC) — Power of Attorney Pipeline, 2021–2023
Built with ABBYY FlexiCapture & ABBYY Vantage. The pipeline processed Power of Attorney documents (fr. Pouvoir de gestion) across NL/FR/BE/DE markets. The first step was country and document-type recognition — each market produced different layouts and languages requiring separate classification models.

Core extraction goal: detect all instances of account holders and proxies (representatives granted authority) within a single document, including cases with multiple parties. For document types that required it, a pre-processing gate detected the presence of a handwritten signature using pixel density analysis (OpenCV + Pillow) — documents without a valid signature were rejected before entering the OCR queue. Achieved 70% end-to-end accuracy across all markets.
ING Hubs Poland (GKYC) — Identity Document Scan & Code Extraction, 2021–2023
Built with ABBYY FlexiCapture & ABBYY Vantage. Pipeline for extracting structured data from scanned identity documents (national IDs, passports, residence permits) across 20+ countries in Europe and beyond. The primary technical challenge was reading and parsing the machine-readable codes and data fields on document reverses — including MRZ (Machine Readable Zone) lines, barcodes, and country-specific coded fields that vary significantly in format and position between issuing states.

Each country required its own extraction model due to differences in document layout, field encoding, and script. The pipeline covered a broad geographic scope well beyond the Western European core, handling document variants from Central and Eastern Europe and other regions.
ArcelorMittal BCoE Poland — Chemical Research Report Extraction, 2023–present
Took over and maintained an existing Azure Document Intelligence pipeline for extracting data from chemical laboratory research reports. The core challenge was the high layout variance — reports originated from laboratories across the world, each producing documents in different formats, structures, and conventions, with layouts changing frequently over time.

My role was to design and maintain predefined extraction rules for each report type as new variants appeared, mapping extracted fields into standardised columns in a central database. This required continuous rule authoring, regression testing when layouts shifted, and ensuring that data from heterogeneous sources landed correctly in a unified schema for downstream reporting and analytics.

Extended tech stack

full picture
ABBYY FlexiCaptureABBYY VantageAzure Document Intelligence Azure Form RecognizerAzure Computer Vision OCR OpenCVPillowPytesseract (evaluation) PydanticPandasScikit-Learn Python requestsAzure Blob StorageSQL / MongoDB GPT-4o (LLM-assisted extraction)LangChainJenkins CI/CDGit

Python image processing & OCR libraries

python ecosystem

All image pre-processing in my pipelines is written in Python. Pillow handles format conversion, rotation correction, and colour normalisation before OCR engines receive the image. The four most widely used open-source Python OCR libraries are:

Wrapper · Tesseract
Pytesseract
Python binding for Google’s Tesseract engine. Industry-standard open-source OCR, supports 100+ languages. Ideal for Latin-script documents with clean scan quality.
Deep learning · GPU
EasyOCR
PyTorch-based, supports 80+ languages out of the box. Excellent on complex layouts and mixed-language documents. No external engine required.
Wrapper · multi-engine
docTR
Mindee’s TensorFlow/PyTorch OCR library focused on document understanding. Clean API, strong on structured business documents and receipts.
Pillow (PIL) Pytesseract EasyOCR PaddleOCR docTR Python 3 NumPy OpenCV PyTorch

About the Author

Leave a Reply

Your email address will not be published. Required fields are marked *

You may also like these