CNOCR: The test set has the highest accuracy rate of 98%, and a Chinese OCR package with a recognition model

Posted Jun 16, 20202 min read

Today, Gitee introduces you to a Chinese OCR package. Everyone knows that training a model is a very time-consuming and laborious task, but today this project already comes with a trained recognition model, we only need to download it and use it, it can be said that it is very convenient, then let s go Look at the details of this project.

Project name:cnocr

Project Author: cyahua

Open source license agreement:Apache-2.0

Project address:

Project Description

cnocr is a Python 3 package for Chinese OCR. Cnocr comes with a trained recognition model, which can be used directly after installation.

cnocr is mainly for printed text pictures with simple typesetting, such as screenshot pictures and scanned documents. Cnocr's currently built-in text detection and branching module cannot handle complex text layout positioning. If it is used for scene text picture recognition, it needs to be combined with other scene text detection engines.


Directly usable models

The ocr model of cnocr can be divided into two stages:the first stage is to obtain the local coding vector of the ocr picture, and the second part is to perform sequence learning on the local coding vector to obtain the sequence coding vector. The current two stages include the following models:

  1. Local coding model(emb model)
  2. conv:multi-layer convolutional network;
  3. conv-lite:smaller multi-layer convolution network;
  4. densenet:a small densenet network;
  5. densenet-lite:a smaller densenet network.
  6. Sequence coding model(seq model)
  7. lstm:two-layer LSTM network;
  8. gru:two-layer GRU network;
  9. fc:Two-layer fully connected network.

cnocr currently contains the following models that can be used directly. The trained models are all placed in the cnocr-models project, which can be downloaded for free:


The initial code for this project forks from crnn-mxnet-chinese-text-recognition, thanks to the author.

But the source project is not convenient enough to use, so I did some packaging and refactoring on this basis. The main changes are as follows:

  • No longer need to install MXNet WarpCTC Loss, and use native MXNet CTC Loss instead. So the installation is minimal!
  • Comes with a trained Chinese OCR recognition model. No additional training is required!
  • Added prediction(or inference) interface. So easy to use!

If you are interested in this project and want to try the effect of recognition in person, you can click on the link at the back to go to the project homepage to see it. If you feel good, please give it a Star: /cnocr