I am trying to recognize a barcode using simple CNN treating it like a multi-digit recognition problem. The results are not very good. So I was looking was some better deep learning models for the same. During my search, I did not find any OCR model being tried on barcodes. So my question is - Can OCR models be trained to recognize barcodes. I find the task of barcode detection and recognition very similar to text recognition. Is there something I am missing?
-
Hi! Very interesting approach. The answer depends on which barcode symbologies are you trying to read (1D barcodes like EAN, or 2D like QR Code and PDF417)? And what do you exactly mean by "recognition" - I suppose it's reading the contents of the barcode? – Cerovec May 10 '20 at 06:59
-
I am trying to read 1D barcodes..yes like EAN-13. Yes, I need to read the contents. Although I am more interested in finding out can OCR work on barcodes? – snowdenassange May 10 '20 at 20:48
1 Answers
While CNNs can be used to read the contents of the barcode, especially in the scenario where massive datasets of images are available for training, it is tough to match the performance of a classical barcode reading algorithm with standard AI approaches.
The difference between reading the text and reading the barcode is structural. Text is fundamentally unstructured, while barcodes are designed to be structured for readability using specifically engineered decoding algorithms.
All these algorithms for reading have rules which are, in many cases, not so hard to implement. On the other hand, CNNs would have a hard time and need vast amounts of data to learn those rules.
Also, many barcode symbologies (EAN included) use error detection or correction algorithms (like check-digits), which can be integrated into the error-recovery loop to increase the performance of the scanning further.
So, in theory, OCR and Barcode scanning are similar problems, while in practice, there are substantial differences.
Note: I'm working at Microblink, where we do R&D in the area of barcode scanning and text recognition. When it comes to barcode scanning, we've tried basically everything in the AI repertoire to get the most out of it, and ended up using both CNNs and classical algorithms working tightly together.

- 1,273
- 10
- 19