Case studies / Noqta

Rethinking document intelligence without the ML tax

Tablet displaying a software interface named Noqta with project documentation, including tables and text blocks on screen.

+10%

F1-score improvement in OCR accuracy

0

Training data needed to start processing

100%

CPU-based processing pipeline

TL;DR

The default way to build document understanding is a fine-tuned layout model, a GPU cluster and training data.

We built Noqta instead: a Python package that turns raw PDFs into OCR-ready crops with a five-stage classical computer vision pipeline, running entirely on CPU.

Used as a preprocessing step before OCR, it increased the F1-score of our client's system by 10%, with no training data and no GPU.

The instinct when building a document understanding system in 2026 is predictable: a fine-tuned layout model, a GPU cluster, training data, and a wait. We took a different path that is faster, leaner, cheaper and easier to explain.

Noqta is a Python package that takes raw PDF documents and turns them into high-quality image crops of text blocks, tables, figures and stamps, ready for OCR. No training data, no GPU, no black box.

The challenges

Most teams turn to object detection models or document foundation models, which carry hidden costs that compound fast.

1. Training data dependency

Every new document class, language or layout can require annotated examples, and that cost never goes away.

2. Infrastructure overhead

GPU setup, model versions and inference servers cost money without solving the real problem.

3. Opacity

When a model crops a box in the wrong place, debugging is largely guesswork.

4. Latency and throughput

Batch inference through a neural network is a hard ceiling on how fast documents can be processed at scale.

The Noqta approach: classical CV, done seriously

A document page is a distribution of dark pixels on a light background: coherent regions cluster together and whitespace separates them. Noqta's pipeline has five composable stages, each tunable, inspectable and running entirely on CPU.

1. Adaptive rendering and binarization

Noqta calculates a dynamic scale factor per page so the longest side fits a configurable pixel budget, keeping clustering fast from a business card to an A3 drawing. Binarization uses Otsu's method to find the optimal threshold automatically.

2. EDT smudging

A Euclidean Distance Transform connects fragmented pixel clusters by blooming content regions outward by a precise margin, close enough to join broken characters and far enough to keep real whitespace intact.

Technical architectural drawings showing detailed plumbing and piping components with labels and a title block for a project titled 'Pennsylvania' at the bottom right.

EDT smudging connects fragmented pixels into coherent regions while preserving real whitespace.

3. Frame removal via Hough transform

A Sobel edge detector and a probabilistic Hough transform find near-perfect horizontal and vertical lines spanning most of the page, and whiten them out before clustering.

4. Hierarchical clustering on black pixel coordinates

The (x, y) coordinates of every black pixel feed agglomerative hierarchical clustering with a configurable distance threshold and linkage. Single linkage follows the chaining patterns of text lines and table rows, and handles irregular figure boundaries.

Side-by-side comparison of two plots titled 'Page 3 - Black Pixel Map' and 'Page 3 - Hierarchical Clusters'; the left plot shows black pixel clusters on a white background, the right shows the same clusters colour-coded by hierarchical clustering.

Black pixel coordinates clustered into coherent document regions.

5. Multi-stage box suppression and tall-box splitting

The Suppressor removes oversized and fully enclosed boxes, merges high-overlap pairs until stable, and groups small fragments by proximity. Tall boxes go to the Splitter, which cuts on horizontal runs of near-solid white or black pixels and scales the cuts back to the high-DPI image.

Two-pass resolution, full observability

Clustering runs on a low-resolution render (600px longest side by default), and crops are extracted from a re-render at a configurable zoom rate (3× by default), with independent x/y scale factors to eliminate rounding drift. Every stage writes its intermediate output to disk, and a built-in Timer writes per-stage timing CSVs for benchmarking.

What needs to improve

Hierarchical clustering is time-intensive, so speed needs GPU optimization. Frame removal occasionally removes continuous lines of text that span most of the page, which a very low line-break tolerance parameter can prevent.

Conclusion

Used as a preprocessing step before OCR, Noqta increased the F1-score of our client's system by 10%. It runs on any CPU, needs no training data, shows every intermediate result, and can be tuned for almost any document domain through configuration alone.

Noqta is open source, configured through a single JSON dictionary, and processes single PDFs or whole directories. Get in touch.

+10%

F1-score improvement in OCR accuracy

0

Training data needed to start processing

100%

CPU-based processing pipeline

Use case: document layout analysis | Industry: document AI, data extraction

Pipeline: adaptive rendering, Otsu binarization, EDT smudging, Hough frame removal, hierarchical clustering, box suppression and splitting

Runtime: 100% CPU, scales horizontally across workers

Observability: intermediate outputs per stage, per-stage timing CSVs

FAQ

How do you do document layout analysis without a trained model?

Treat the page as dark pixels on a light background: binarize, connect fragments with a Euclidean Distance Transform, remove frame lines with a Hough transform, then cluster black pixel coordinates hierarchically.

Can document AI run without a GPU?

Yes. Noqta's whole pipeline runs on CPU with no CUDA dependencies, and scales horizontally across workers.

How much did Noqta improve OCR accuracy?

Using it as a preprocessing step before OCR increased the F1-score of our client's system by 10%.

When is classical computer vision better than a deep learning model?

When you need no training data, every decision inspectable and every failure diagnosable. See why model selection is an architectural decision.

About Noqta
Noqta is an open-source Python package for document layout analysis that turns raw PDFs into OCR-ready crops of text blocks, tables, figures and stamps. github.com/Khaledhamza77/Noqta ↗
Tags
AI agents
Tech stack
Python,
Classical computer vision,
CPU-only pipeline
Want similar results?
We build AI agents and software for teams ready to move faster.
Get in touch
contact image