在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:OCR开源软件地址:https://gitee.com/microic/tr开源软件介绍:tr - Text Recognition一款针对扫描文档的离线文本识别SDK,核心代码全部采用C++开发,并提供Python接口 编译环境: Ubuntu 16.04 更新说明
Requirements
GPU版本安装说明如果对速度有要求,推荐安装GPU版本 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 Testpython2 demo.py # python2兼容测试python3 test.py # 可视化测试python3 test-multi-thread.py # 多线程测试 关联项目
Python Exampleimport 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++ Exampletr_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); 效果展示 |
请发表评论