Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/triwinds/ppocr-onnx
利用 onnxruntime 及 PaddleOCR 提供的模型, 对图片中的文字进行检测与识别.
https://github.com/triwinds/ppocr-onnx
Last synced: about 2 months ago
JSON representation
利用 onnxruntime 及 PaddleOCR 提供的模型, 对图片中的文字进行检测与识别.
- Host: GitHub
- URL: https://github.com/triwinds/ppocr-onnx
- Owner: triwinds
- License: apache-2.0
- Created: 2021-09-11T14:37:43.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-10T13:02:18.000Z (over 1 year ago)
- Last Synced: 2024-04-25T10:26:36.429Z (5 months ago)
- Language: Python
- Size: 15.5 MB
- Stars: 61
- Watchers: 3
- Forks: 16
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PPOCR-ONNX
## 简介
利用 onnxruntime 及 PaddleOCR 提供的模型, 对图片中的文字进行检测与识别.
### 使用模型
- 文字检测: `ch_PP-OCRv3_det_infer`
- 方向分类: `cls mobile v2`
- 文字识别: `ch_PP-OCRv2_rec_infer`## 参考
- [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR)
- [手把手教你使用ONNXRunTime部署PP-OCR](https://aistudio.baidu.com/aistudio/projectdetail/1479970)
- `ch_PP-OCRv3_det_infer` 及 `ch_PP-OCRv2_rec_infer` 模型来自 [RapidAI/RapidOCR](https://github.com/RapidAI/RapidOCR)## 安装
```bash
pip install ppocr-onnx
```## 使用
```python
from ppocronnx.predict_system import TextSystem
import cv2text_sys = TextSystem()
# 识别单行文本
res = text_sys.ocr_single_line(cv2.imread('single_line_text.png'))
print(res)# 批量识别单行文本
res = text_sys.ocr_lines([cv2.imread('single_line_text.png')])
print(res[0])# 检测并识别文本
img = cv2.imread('test.png')
res = text_sys.detect_and_ocr(img)
for boxed_result in res:
print("{}, {:.3f}".format(boxed_result.ocr_text, boxed_result.score))
```