PrismOCR: Deterministic Computer Vision for Label Extraction
By Sameer Joshi
A production-ready OCR engine that extracts structured product label data (GTIN, FSSAI, net weight, MRP, dates, and more) using barcode decoding and deterministic computer-vision rules, with validator-gated accuracy and zero data fabrication. There is no LLM involved: this is pure computer vision, running entirely offline with zero per-document API cost.
Platform
Web & Batch
Duration
Ongoing
14
Structured fields extracted per label
0
Fields fabricated or guessed, by design
$0
Per-document OCR API cost
6
Label faces (Front/Back/Left/Right/Top/Bottom) merged per product
Project overview
PrismOCR proves that a zero-hallucination extraction requirement is best met not by a larger model but by the deliberate absence of one. By combining barcode-first identification, checksum validation, anchored keyword extraction, and multi-engine OCR with automatic fallback, the platform delivers a guarantee generative pipelines cannot: every value returned is either decoded directly from real pixels or it is not returned at all. The architecture (queue-backed batch processing, persistent job history, optional authentication) is built for production deployment, not a lab demo, while remaining extensible: optional AI-assisted enhancements can be layered on top of the deterministic core when a use case calls for it, without ever compromising the core guarantee of source-grounded, auditable extraction.
Platform
Web & Batch
Duration
Ongoing
Type
FMCG & Retail: Document Intelligence
Stack
12 technologies
The challenge
FMCG and retail teams manage catalogues of thousands of SKUs, each requiring accurate label data (GTIN, FSSAI licence number, net weight, MRP, and manufacturing/expiry dates) for regulatory compliance, e-commerce listings, and data-pool submissions. Manual transcription from label photographs is slow and does not scale, while generative OCR and LLM-based extraction tools carry an unacceptable risk: they can produce fluent, plausible-looking values that were never actually printed on the label. For regulated numeric fields, a fabricated digit is not a minor error: it is a compliance and financial risk.
Manual transcription of label data (GTIN, FSSAI licence numbers, net weight, MRP, expiry dates) from thousands of product images is slow, error-prone, and does not scale to a catalogue of thousands of SKUs.
Generative and LLM-based OCR tools can silently invent plausible-looking values, a serious risk for regulated fields like GTIN and FSSAI licence numbers, where a single wrong digit carries compliance and financial consequences.
Cloud OCR and vision APIs charge per document, which becomes cost-prohibitive at high volume and raises data-privacy concerns for proprietary product catalogues.
Teams need an audit trail showing exactly where each extracted value came from (the source image, snippet, and confidence), not just a final answer.
A single product typically has multiple label faces (front, back, ingredients panel, nutritional panel) whose data must be reconciled into one authoritative record.
What we set out to do
- 01
Build a deterministic, computer-vision-based extraction pipeline that never fabricates data: every value is either barcode-decoded or a verbatim, validator-passed OCR read.
- 02
Achieve zero-tolerance accuracy on regulated numeric fields (GTIN, FSSAI, net weight, MRP) through checksum validation, format gates, and confidence thresholds.
- 03
Eliminate per-document OCR API costs and external AI dependency by running the entire extraction pipeline offline on commodity hardware.
- 04
Handle real-world multi-face packaging by reconciling front, back, left, right, top, and bottom label images into a single authoritative product record.
- 05
Move from single-image testing to a deployable, multi-user batch workflow with persistent job history and optional deployment authentication.
- 06
Design the platform to be extensible: ready to incorporate optional AI-assisted enhancements in the future without ever making the core OCR workflow dependent on them.
How we solved it
Barcode-First Product Identification
Every extraction begins by decoding the printed barcode using zxing-cpp, run against both the original image and a 2x-upscaled variant to recover barcodes on small or low-resolution captures. A correctly decoded, checksum-valid barcode anchors the GTIN before any text recognition is attempted.
Key decision
Treat barcode decoding as the primary identification anchor rather than a fallback: OCR corroborates and extends product identity, it never originates it.
Result
GTIN values are backed by a decoded, checksum-validated barcode wherever one is present, removing a major class of transcription error before extraction begins.
Multi-Engine OCR with Automatic Fallback
Text recognition runs through a chained sequence of open-source engines (PaddleOCR as the primary engine, EasyOCR as a secondary fallback, and Tesseract as a lightweight final fallback), so extraction keeps working even in constrained or fully offline environments.
Key decision
Standardize every engine's output into a common token format (text, confidence, bounding box) so the extraction logic is engine-agnostic and the fallback chain stays transparent.
Result
The pipeline degrades gracefully instead of failing outright, and can run entirely offline with zero dependency on any external OCR or AI service.
Anchored, Validator-Gated Field Extraction
Each field is extracted only near its expected anchor keywords (dates only near "MFG"/"EXP", licence numbers only where an FSSAI anchor is present) and is then passed through a format or checksum validator specific to that field: GTIN check-digit validation, 14-digit FSSAI format rules, unit-bearing weight patterns, and similar rules.
Key decision
Adopt a strict "drop on doubt" policy: a field that cannot be both anchored and validated is returned as null rather than a best guess, so the system never fabricates a plausible-looking but incorrect value.
Result
Every populated field carries either a validated checksum or a verbatim, anchor-confirmed OCR read, with zero tolerance for fabricated or guessed data, by design.
Multi-Face Image Consolidation
Product packaging carries information across several physical faces: front, back, left, right, top and bottom. Each face is processed independently, then a consolidation step merges the per-face results field by field, using confidence scores combined with a per-field "panel prior" (for example, MRP and expiry date are expected on the back panel, brand on the front).
Key decision
Surface conflicting reads across faces explicitly, with a full ranking trace, rather than silently picking one, so any disagreement between panels is visible and auditable.
Result
A single, reconciled product record is produced from multiple label images, with built-in traceability back to which face and which OCR read each field value came from.
Batch Processing at Production Scale
A Redis-backed job queue and long-lived worker process allow products to be submitted and processed as batches rather than one at a time, with incremental progress tracked in Redis and every completed job permanently recorded in a SQLite job history store, including CSV/JSON export and image re-download.
Key decision
Persist job history independently of the TTL-bounded queue so completed batch runs stay auditable and re-downloadable long after processing finishes, and add optional HTTP Basic authentication to protect the deployment.
Result
The system moves beyond single-image testing to a deployable, multi-user batch workflow suitable for production document-processing volumes.
Measurable impact
14
Structured fields extracted per label
0
Fields fabricated or guessed, by design
$0
Per-document OCR API cost
6
Label faces (Front/Back/Left/Right/Top/Bottom) merged per product
3
Offline OCR engines chained with automatic fallback
100%
GTIN outputs gated by checksum validation
Tech stack
What we learned
Codeprism's OCR platform proves that enterprise-grade document intelligence doesn't require a large language model or a per-document API call. By anchoring every extraction in decoded barcodes, a chained multi-engine OCR pipeline, and anchor-and-validator-gated field rules, the system delivers extraction that is consistent, auditable, and private enough to run entirely within a client's own infrastructure, at zero per-document cost and zero external AI dependency. There is no LLM involved. This is pure computer vision. The platform is production-ready today, with batch processing, job history, and deployment authentication already in place, and it was designed with extensibility in mind: optional AI-assisted enhancements can be added later as a genuine hybrid capability, layered on top of the deterministic core rather than replacing it. For organizations digitizing product labels, verifying regulatory compliance, or automating catalog data entry, this approach delivers accuracy they can verify, costs they can predict, and a system they fully control.
- 01
Deterministic computer vision, not an LLM, powers every extraction, giving clients consistency, predictability, and full data privacy.
- 02
Barcode-first identification plus checksum and format validators mean the system never fabricates a value: unclear or unverifiable data is dropped, not guessed.
- 03
Multi-engine OCR fallback and multi-face image consolidation make the pipeline resilient to varied label layouts, image quality, and fully offline environments.
- 04
Batch processing, persistent job history, and optional authentication make the platform ready for real production workloads, not just single-image demos.
- 05
The architecture is extensible by design: optional AI-assisted enhancements can be added later as a genuine hybrid capability, without ever making the core OCR workflow dependent on GPT or any generative AI model.
More case studies
Building PrismAnalyst: A Privacy-First, Multi-Agent AI Analyst for Business Data
View case study AI Backend & ArchitectureBuilding PrismBot: A Multi-Tenant, Multi-Agent Chat Architecture
View case study SaaS & MessagingWhatsApp Cloud API console: how we built PrismWA
View case studyReady to build something that matters?
We solve problems that don't have Stack Overflow answers. Let's talk.
Book a Discovery Call