Home

Awesome

本项目基于chineseocrpsenet 实现中文自然场景文字检测及识别

环境


Docker 环境

PSENET 编译

cd psenet/pse
rm -rf pse.so 
make 

实现功能

2020.07.02更新

2020.03.16更新

2020.03.12更新

竖排字体样式:

<img width="300" height="200" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/vertical_text_fonts/imgs/test.jpg"/>

竖排生成的竖排文本样例:

<img width="256" height="32" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/vertical_text_fonts/imgs/00156360.jpg"/> <img width="256" height="32" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/vertical_text_fonts/imgs/00000027.jpg"/> <img width="256" height="32" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/vertical_text_fonts/imgs/00156365.jpg"/> <img width="256" height="32" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/vertical_text_fonts/imgs/00187940.jpg"/>

web服务启动

cd chineseocr_lite## 进入chineseocr目录
python app.py 8080 ##8080端口号,可以设置任意端口

访问服务

http://127.0.0.1:8080/ocr

Flask-RESTful API demo

cd chineseocr_lite && python flask_app.py

- 请求url: http://ip:port/api/v1/ocr
- 请求方式:POST
- 请求参数
    - ImgString:图片转base64后的字符串, str
- 返回实例
{
    "code": "SUCCESS",
    "text": "不配图我总觉得不舒服不完整不专业"
}

识别结果展示

<img width="500" height="300" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/test_imgs/5_res.jpg"/> <img width="500" height="300" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/test_imgs/4_res.jpg"/> <img width="500" height="300" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/test_imgs/1_res.jpg"/> <img width="500" height="300" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/test_imgs/2_res.jpg"/> <img width="500" height="300" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/test_imgs/3_res.jpg"/>

ncnn检测识别展示(x86 cpu 单进程)

<img width="500" height="300" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/ncnn_project/ocr/res_imgs/res_3.jpg"/> <img width="500" height="300" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/ncnn_project/ocr/res_imgs/res_2.jpg"/>

flask-restful api 内存测试(dbnet)

200张图片测试稳定在1-1.5G左右的内存

参考

  1. ncnn https://github.com/Tencent/ncnn
  2. crnn https://github.com/meijieru/crnn.pytorch.git
  3. chineseocr https://github.com/chineseocr/chineseocr
  4. Psenet https://github.com/WenmuZhou/PSENet.pytorch
  5. 语言模型实现 https://github.com/lukhy/masr