English (unofficial) translations of posts at kexue.fm
Source

A Brief Exploration of OCR Technology: 1. Overview

Translated by DeepSeek V4 Pro. Translations can be inaccurate, please refer to the original post for important stuff.

Foreword: As mentioned in previous blog posts, last month I participated in the 4th Teddy Cup Data Mining Contest. I worked on Problem A, which is related to OCR systems, and I promised to open-source the final results. Recently, I have been busy with graduation and moving, so I haven’t had time to organize this content. I am now taking some time to put it together.

I am publishing these results not because they are particularly powerful or cutting-edge (on the contrary, after comparing our work with the Baidu paper “Progress in Image Recognition Based on Deep Learning: Some Practices at Baidu”, I realized that our content is essentially still following the traditional framework and is far from keeping up with current trends), but because although OCR technology is relatively mature, there are almost no articles online that provide a detailed explanation of an OCR system. This article is intended to supplement that gap. I have always believed that technology must be open-sourced to develop (of course, this point is debatable in China, as open-sourcing can easily lead to copycatting). Whether it is research in mathematics and physics or data mining, I publish most of my work on my blog to exchange ideas with everyone.

Returning to the main topic: although the results are not exceptional, overall, we have implemented a relatively complete and preliminary OCR system. In other words, we have basically performed all the steps required to build an OCR system; as for how well they were done, I can only say they are passable. There may be some hyperbolic rhetorical devices in the narrative of the article; I hope readers will use their own judgment.

Below is our paper abstract:

We designed a series of algorithms to complete tasks such as text feature extraction and text localization. We established a character recognition model based on Convolutional Neural Networks (CNN) and finally combined it with a statistical language model to improve the results, successfully constructing a complete OCR (Optical Character Recognition) system.

In terms of feature extraction, we abandoned the traditional “edge detection + erosion and dilation” method. Based on some basic assumptions, we obtained high-quality text features through steps such as grayscale clustering, layer decomposition, and denoising. These text features can be used for the second step of text localization and can also be directly input into the third step’s model for recognition without additional feature extraction work.

In terms of text localization, we first integrated feature fragments using a proximity search method to obtain single-line text features, and then segmented the single-line text into individual characters using a statistical method. Tests show that this segmentation approach handles mixed Chinese and English text segmentation very well.

In terms of optical recognition, we established a single-character recognition model based on a CNN deep learning model. We generated 1.4 million samples for training and ultimately obtained a robust single-character recognition model. The training accuracy was 99.7%, and the test accuracy was 92.1%. Even when image noise was increased to 15%, an accuracy of around 90% was maintained.

Finally, to further improve the results based on the previous work, we integrated a language model. We calculated the transition probability matrix for common Chinese characters using hundreds of thousands of WeChat texts and used the Viterbi algorithm for dynamic programming to obtain the optimal recognition combination.

Combining the above four parts results in a complete OCR system. After testing, our system shows good performance in recognizing printed text and can serve as a text recognition tool for platforms such as e-commerce and WeChat.

References:

[1] Li Meng; Research on Text Detection Algorithm Based on Multi-scale Gabor Filter and BP Neural Network; Computer Software and Theory; 2007

[2] Kernel Density Estimation; Wikipedia

[3] Xavier Glorot, Antoine Bordes, Yoshua Bengio; Deep Sparse Rectifier Neural Networks

[4] Alex Krizhevsky, Ilya Sutskever, Geoffrey E. Hinton; ImageNet Classification with Deep Convolutional Neural Networks

[5] Dropout: A Simple Way to Prevent Neural Networks from Overfitting

[6] Wu Jun; “The Beauty of Mathematics” (Second Edition); Chapter 3

[7] Wu Jun; “The Beauty of Mathematics” (Second Edition); Chapter 26

When reposting, please include the original address of this article: https://kexue.fm/archives/3774

For more detailed reposting matters, please refer to: “Scientific Space FAQ”