Giter Club home page Giter Club logo

ocr_chinese's Introduction

ocr_chinese

Keras实现自然场景下图像文字检测和识别,EAST/CRNN/CTC.

代码都是使用Keras+后端TensorFlow实现,方便生产环境部署和维护;

  • EAST模型实现文字检测,文字方向支持90° ~ -90°间任意角度,包含中字/英文/数字/符号等,目标检测的方式画框定位,返回文本框的四个坐标。
  • CRNN模型实现不定长文字识别,输出使用CTC算法模块。
  • TensorFlow自带CTC,算法原理可以参考我的博客CTC算法在OCR文字识别上的应用,还有其他博文

开发环境

python3.6 + tensorflow1.14.0 + keras2.1.6
# 或使用pip环境复制
pip install -r environment.txt
# GPU环境
NVIDIA Drivers/CUDA/cuDNN

How to use

从输入一张图片到端到端的检测及识别文字

python predict.py
  • 当检测比较正的文本,且是书面文字(不是艺术字),准确率比较高,主要确保EAST模型框选文本正确,不要框选不全,涉及模型训练和超参数调试,具体看Training部分;

east_1

crnn_1

  • 当检测存在角度的文本,确定文本四个顶点的坐标,旋转及边缘延伸,确保输入CRNN模型时文字完整性;

east_2

crnn_2

可以看到输入CRNN时裁剪下来的文字图片;

res

EAST模型检测文本框

cd east
python predict.py

CRNN模型识别文字

cd crnn
python predict.py

代码结构

- crnn                    # 文字识别模型
|-- predict_crnn.py       # 预测文字,衔接east模型,裁剪及文字旋转
|-- data                  # 数据集预处理
|-- net                   # crnn网络实现及训练,char_std_5990.txt文字对应标签序
|-- model                 # 模型weights

- east                    # 文字检测模型
|-- predict_east.py       # 预测文字位置,画框 
|-- data                  # images数据集预处理
|-- net                   # east网络实现及训练,network/loss/training
|-- model                 # 模型weights

- predict.py              # 实现end-to-end预测,模型衔接

Training

  • EAST

    本项目数据集:天池ICPR MTWI 2018 挑战赛二网络图像的文本检测。淘宝上收集的商品图片,数据量充分,涵盖数十种字体,几个到几百像素字号,多种版式,较多干扰背景。(百度云/提取码:sxhh)

    其他数据集:MSRA-TD500 自然场景下的文本检测数据集。

  • CRNN 本项目数据集:通用中文语料库,通过截取文本和随机生成,字体经过了大小、灰度、模糊、透视等变化,共360万张图片,图像分辨率w*h为280x32,涵盖了汉字、标点、英文、数字共5990个字符。(百度云/提取码:4m2q)

    其他数据集:

    ​ 1、Synthetic Data for Text Localisation 在复杂背景下人工合成的自然场景文本数据。英文GitHub,中文GitHub

    ​ 2、A Large Chinese Text Dataset in the Wild 街景中文字符检测和识别的数据集,包括平面文本、凸起文本、光照不足的文本、远处文本、部分遮挡文本等。

    本项目使用的数据集针对的是书面文字,所以在识别书面和打印文字上效果较好,如果要识别艺术字或手写体需要增加相应训练集。

Documents

Writing ......

参考

ocr_chinese's People

Contributors

felixbrave avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.