In today’s article on Habré, we will tell you about the next recognition task. Consider the problem of barcode recognition, which is very relevant in connection with the continuous development of the labeling system and the system of payment for goods by QR code in 2021.
The barcode, or barcode, is certainly an important human invention that has changed the course of our lives. In one of our articles on Habré, we already talked about how this method of coding information evolved.
Today we will not delve into the technical part, but consider the existing problems in the implementation of barcode recognition technology. Indeed, where can problems arise if barcoding is such a special way of encoding data, which is precisely designed to ensure fast and trouble-free reading of data by a machine? All barcode decoding algorithms are “chewed” to the smallest detail. The problem of decoding barcodes is perfectly solved without using any neural networks and other “horror stories” of our century. It seems that the barcode recognition technology is the “cosmodrome” from which a large number of open source libraries should take off into a happy future.
It turns out that this is not the case. We received the first call about the “uselessness” of everything free for solving the problem of recognizing barcodes in the form of another request from an old client – one commercial bank (from the top 10), whose manufacturability many may envy. Colleagues have demonstrated that popular free libraries categorically cannot cope even with QR codes. There is no need to even talk about codes like AZTEC (this type of barcodes, which is found on payment systems, is visually similar to a QR code, but at the same time it is radically different from it in the complexity of decoding).
We plunged into the task a little and very quickly realized that almost all libraries “lost their positions” halfway through, even before they even reached recognition. After all, the greatest difficulty in the task is the exact localization and orientation of the recognized barcode. At first glance, it seems that the problem should be solved “in no time”, since many barcodes have special black-and-white square “targets” for localization in their structure. But you and I know that the problem of color constancy, the solution of which just allows you to understand which objects are colored in what way, is not at all easy. And the targets, by the way, are not always black and white and not even always square (design solutions that exploit different colors and shapes greatly interfere with the task of barcode recognition).
To fully immerse yourself in the complexity of the task of barcode recognition, imagine what artifacts occur when the camera moves, photographs in the dark with a flash, resets a barcode from a monitor, and tries to recognize a laminated barcode. And also imagine what a barcode looks like with a huge amount of data inside (you can not even imagine, but just take a payment receipt, for example, for a kindergarten).
There is another reason why we did not stay away from solving the problem of barcode recognition. In our country, the technology of payment by QR codes is developing by leaps and bounds (to confirm my words, see, for example, the material on vc.ru here, here and here). Being participants With the UN Global Compact and strong adherents of responsible AI, we simply could not let the market not appreciate the full benefits of QR payments due to the actual inability of the free recognition libraries available. And let’s not forget about the growing “Product Marking and Traceability System”. All this prompted us to create a barcode recognition module Smart Code Engine…
To test the effectiveness of the resulting solution, we ourselves created a small set of photos of QR codes. The only requirement is to photograph barcodes the way ordinary users do. Below are examples of images from our dataset.
As you can see, the images are far from perfect. We compared the quality of work Smart Code Engine with two popular opensource solutions: OpenCV 4.5.1 (an open source computer vision library that is often used when building an AI system) and Zxing (open source library for barcode recognition). The table below shows the results:
Smart Code Engine
How should these numbers be interpreted? Simple enough:
Opencv seriously loses Zxing for decoding quality;
Smart Code Engine provides 19 times fewer errorsthan Zxing (there is no point in comparing it with OpenCV).
The question arises: “What are the mistakes of the considered systems?” Let’s analyze errors only for Smart Code Engine and Zxing. Below is the only image where the Smart Code Engine went wrong.
Indeed, a difficult case for machine vision systems (glare, geometric distortion, complex background). Well, we will work further and improve the quality of recognition. By the way, ZXing also failed with this image.
Here are some examples of what ZXing is wrong about. Also not the simplest cases (serious projective distortions, high density, complex background).
Today, Smart Code Engine provides high-quality recognition of one- and two-dimensional barcodes from a variety of bills and receipts, including utility and government bills, tax documents and invoices, as well as tickets, checks, invoices, price tags, posters and ads. … The QR code reader is capable of reading inverted codes and is also resistant to any orientation. The current version of Smart Code Engine supports QR Code, AZTEC, PDF 417, Data Matrix, codabar, CODE_39, CODE_93, CODE_128, EAN_8, EAN_13, ITF, UPC_A, UPC_E recognition.
Smart Code Engine has already been implemented in mobile applications of Tinkoff Bank, Roketbank, SDM-Bank, Bank Saint Petersburg. We are sure this is just the beginning.