# 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 cv2
text_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))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/triwinds/ppocr-onnx",
"name": "v-ppocr-onnx",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "triwinds",
"author_email": "triwinds@foxmail.com",
"download_url": "https://files.pythonhosted.org/packages/de/1f/495d8879015e2a3cd280e6366a08c6035d8731a370ff717f980ad4417cb0/v-ppocr-onnx-0.0.4.1.tar.gz",
"platform": null,
"description": "# PPOCR-ONNX\n\n\n## \u7b80\u4ecb\n\n\u5229\u7528 onnxruntime \u53ca PaddleOCR \u63d0\u4f9b\u7684\u6a21\u578b, \u5bf9\u56fe\u7247\u4e2d\u7684\u6587\u5b57\u8fdb\u884c\u68c0\u6d4b\u4e0e\u8bc6\u522b.\n\n### \u4f7f\u7528\u6a21\u578b\n\n - \u6587\u5b57\u68c0\u6d4b: `ch_PP-OCRv3_det_infer`\n - \u65b9\u5411\u5206\u7c7b: `cls mobile v2`\n - \u6587\u5b57\u8bc6\u522b: `ch_PP-OCRv2_rec_infer`\n\n## \u53c2\u8003\n\n - [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR)\n - [\u624b\u628a\u624b\u6559\u4f60\u4f7f\u7528ONNXRunTime\u90e8\u7f72PP-OCR](https://aistudio.baidu.com/aistudio/projectdetail/1479970)\n - `ch_PP-OCRv3_det_infer` \u53ca `ch_PP-OCRv2_rec_infer` \u6a21\u578b\u6765\u81ea [RapidAI/RapidOCR](https://github.com/RapidAI/RapidOCR)\n\n## \u5b89\u88c5\n\n```bash\npip install ppocr-onnx\n```\n\n## \u4f7f\u7528\n\n```python\nfrom ppocronnx.predict_system import TextSystem\nimport cv2\n\ntext_sys = TextSystem()\n\n# \u8bc6\u522b\u5355\u884c\u6587\u672c\nres = text_sys.ocr_single_line(cv2.imread('single_line_text.png'))\nprint(res)\n\n# \u6279\u91cf\u8bc6\u522b\u5355\u884c\u6587\u672c\nres = text_sys.ocr_lines([cv2.imread('single_line_text.png')])\nprint(res[0])\n\n# \u68c0\u6d4b\u5e76\u8bc6\u522b\u6587\u672c\nimg = cv2.imread('test.png')\nres = text_sys.detect_and_ocr(img)\nfor boxed_result in res:\n print(\"{}, {:.3f}\".format(boxed_result.ocr_text, boxed_result.score))\n```\n\n\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "\u5229\u7528 onnxruntime \u53ca PaddleOCR \u63d0\u4f9b\u7684\u6a21\u578b, \u5bf9\u56fe\u7247\u4e2d\u7684\u6587\u5b57\u8fdb\u884c\u68c0\u6d4b\u4e0e\u8bc6\u522b.",
"version": "0.0.4.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "73acd6806f180bd567634669fc3bb931",
"sha256": "9884494a3e04e0abc1e08be6d8c5cc5ca965bd2e7d71a716bab9f2ba7a55d7e7"
},
"downloads": -1,
"filename": "v_ppocr_onnx-0.0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "73acd6806f180bd567634669fc3bb931",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12314408,
"upload_time": "2022-12-04T18:51:53",
"upload_time_iso_8601": "2022-12-04T18:51:53.985498Z",
"url": "https://files.pythonhosted.org/packages/02/83/91967d5584fa6742b7a693ddf5b6d41476444016a82ca6f4930ac468f9dd/v_ppocr_onnx-0.0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "f50ef7c3e213be0fcfe7650a6d84dba6",
"sha256": "d871adb4bd23347c974de94abf6b41f95b5524da635e11a5694241e80b34bdb0"
},
"downloads": -1,
"filename": "v-ppocr-onnx-0.0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "f50ef7c3e213be0fcfe7650a6d84dba6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12314505,
"upload_time": "2022-12-04T18:51:57",
"upload_time_iso_8601": "2022-12-04T18:51:57.349272Z",
"url": "https://files.pythonhosted.org/packages/de/1f/495d8879015e2a3cd280e6366a08c6035d8731a370ff717f980ad4417cb0/v-ppocr-onnx-0.0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-04 18:51:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "triwinds",
"github_project": "ppocr-onnx",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "onnxruntime",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "opencv-python",
"specs": []
},
{
"name": "shapely",
"specs": []
},
{
"name": "pyclipper",
"specs": []
},
{
"name": "pillow",
"specs": []
},
{
"name": "requests",
"specs": []
}
],
"lcname": "v-ppocr-onnx"
}