• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

OCR: Free Offline OCR 离线的中文文本检测+识别SDK

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

OCR

开源软件地址:

https://gitee.com/microic/tr

开源软件介绍:

tr - Text Recognition

一款针对扫描文档的离线文本识别SDK,核心代码全部采用C++开发,并提供Python接口

编译环境: Ubuntu 16.04

更新说明

  • c++接口支持
  • 添加python2支持
  • 去除opencv-python、Pillow依赖,降低部署难度
  • 支持多线程
  • 支持GPU
  • 取消对Windows系统的支持

Requirements

  • python2/python3,需要安装numpy
  • 不支持Windows、CentOS 6、ARM

GPU版本安装说明

如果对速度有要求,推荐安装GPU版本
要使用GPU版本,复制tr_gpu文件夹里面的文件到tr文件夹
注意: 需要先安装CUDA 10.1以及cuDNN 7.6.5

若不想安装CUDA/cuDNN,可以使用docker部署

docker pull mcr.microsoft.com/azureml/onnxruntime:v1.3.0-cuda10.1-cudnn7sudo nvidia-docker run -v /path/to/tr:/path/to/tr --rm -it mcr.microsoft.com/azureml/onnxruntime:v1.3.0-cuda10.1-cudnn7

Install

  • 安装方法一
git clone https://github.com/myhub/tr.gitcd ./trsudo python setup.py install
  • 安装方法二
sudo pip install git+https://github.com/myhub/tr.git@master

Test

python2 demo.py               # python2兼容测试python3 test.py               # 可视化测试python3 test-multi-thread.py  # 多线程测试

关联项目

  • 若需要Web端调用,推荐参考TrWebOCR

Python Example

import tr# detect text lines, return list of (cx, cy, width, height, angle)print(tr.detect("imgs/web.png", tr.FLAG_RECT))# detect text lines with angle, return list of (cx, cy, width, height, angle)print(tr.detect("imgs/id_card.jpeg", tr.FLAG_ROTATED_RECT))# recognize text line, return (text, confidence)print(tr.recognize("imgs/line.png"))# detect and recognize text lines with angle, return list of ((cx, cy, width, height, angle), text, confidence)print(tr.run("imgs/id_card.jpeg"))

C++ Example

tr_init(0, 0, "crnn.bin", NULL);#define MAX_WIDTH		512int unicode[MAX_WIDTH];float prob[MAX_WIDTH]; auto ws = tr_recognize(0, (void *)"line.png", 0, 0, 0, unicode, prob, MAX_WIDTH);tr_release(0);

效果展示



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap