/ChineseAddress_OCR

Photographing Chinese-Address OCR implemented using CTPN+CTC+Address Correction. 拍照文档中文地址文字识别。

Primary LanguagePython

ChineseAddress_OCR

环境不可控场景下拍照文档地址文字识别

Photographing Chinese-Address OCR implemented using CTPN+CTC+Address Correction.

This is a project of the 2018 Deecamp 25th group (DRPRG). Thanks to my team members!
这个是 2018年 Deecamp 25组 (深度受限抠图小组) 的项目,非常非常的感谢每一位队友!

Our Demo: https://www.bilibili.com/video/av30081208
Our Wechat Program (微信小程序): OCRdeecamp

Reference Paper: Detecting Text in Natural Image with Connectionist Text Proposal Network
Reference Code: https://github.com/YCG09/chinese_ocr (Thanks to Yang Chenguang)

Method

Text Detection : CTPN
Text Recognition: CTC+DenseNet
Address Judgment: Light GBM or textgrocery
Address Correction: Fuzzy matching based on address library

About Code

demo_final.py
You can simply run demo_final.py for inference. Input a picture and output the Chinese address string.
run_flask.py
Communication between server and Wechat program with flask
ocr_whole.py
Text detection with CTPN, and text recognition with Densenet
stupid_addrs_rev.py
Address correction using fuzzy-matching based on address library
ctpn
If you want to know more details about CTPN codes, please check https://github.com/eragonruan/text-detection-ctpn
wechat_program
Some files of Wechat program (微信小程序的一些文件)

Results

In our dataset, the accuracy of exactly correct is 83%, the accuracy of edit distance less than 3 is 97%.
Our program has high accuracy at identifying very fuzzy multi-line addresses.

If you want to know more details, please read ChineseAddress_OCR_Report.pdf(中文).

Simple Use

You need to create a new py file and call the def demo_flask from demo_final.py to run the project.

from demo_final import demo_flask
image_file="./demo.png" # image path
output_file,ret_total = demo_flask(image_file)
print('Recognition Result:')
print(ret_total)

If you encounter the error related to "converter", you need to rewrite some code lines to Python 3 grammar.