Free Offline OCR 离线的中文文本检测+识别SDK
docker pull mcr.microsoft.com/azureml/onnxruntime:v1.3.0-cuda10.1-cudnn7 sudo 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.git cd ./tr sudo 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 # 多线程测试 python3 test_crnn_pyqt5.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 512 int 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);#### 效果展示
No open issues yet, or sync has not completed.