Some of the legacy digital or analog meters used on the field are either too difficult or costly to replace. For example, old water/gas pipeline meters. Detecting pressure continuously is important for prevention of escalated events. We were looking for non-interventionist solutions and decided to experiment with CV+ML techniques. To start with we picked up digital meter reading. This blog post is part of a series of experiments about which we will update in subsequent posts.
Our tool set included: Raspberry Pi, PiCam and Movidius NCS.
- Tesseract OCR
- Attention OCR
There are a few options to approach this problem. They can be separated into two broad categories: Optical character recognition and Deep learning. Many libraries of the recent time have started using deep learning based model as a part of the overall OCR approach. We evaluate two of the OCR and one deep learning approaches.
Straight up, we gave the library an image of a real world meter’s screen to get a fleeting idea of how it works. Of course, it could not read almost anything, given the background condition and the 7 segment LED letters.
Then, we tried giving an image of machine printed text taken by a phone’s camera. It produced such garbage, that we knew we had to preprocess the image. And so, we did that. The result was much better, but it still missed a few things. With better preprocessing, we managed to get 100% accuracy.
With the experience gained, we gave it 7 segment LED images of individual digits, and it was practically hopeless. We could have modified the algorithms to read the LEDs, but that is a project of its own.
Below are the results of some of the images:
It gave us errors that we were too lazy to handle. It is not a good thing to see an error as the first output!
The only approach left was the deep learning based model trained on MNIST Database. Since we had previous experience with it, we started out simply — by giving it images of handwritten digits. Which, of course, it recognized perfectly.
Encouraged, we gave it an image with multiple digits of 7 segment LED. Failure was that the model had never seen 7 segment digits! Of course, the database consists of human written digits.
Our first hypothesis was that it is being tricked by the cuts between the segments; and that causes it to think these are different digits all together.
So we prepared some images which had simple vertical and horizontal lines without those nasty cuts. Well, it at least recognized something tangible, was not accurate at all.
Custom trained MNIST (small dataset)
We then retrained the model with 1152 images (digits 0 to 9) dataset. The dataset was very small, and consisted of terribly biased data.
Even with this small training step, we could see the model improving!
Considering the evaluation results, we concluded that we can train MNIST to do much better digit recognition, for the task we have.