📄 Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.
Update README
SWHL862b205d72e5
diff --git a/api/README.md b/api/README.mdindex 3970b58..7cf717f 100644--- a/api/README.md+++ b/api/README.md@@ -1,142 +1 @@-## RapidOCR API--<p>- <a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a>- <a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>- <a href="https://pypi.org/project/rapidocr-api/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr-api"></a>- <a href="https://pepy.tech/project/rapidocr_api"><img src="https://static.pepy.tech/personalized-badge/rapidocr_api?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads"></a>-</p>--- 采用`FastAPI` + `uvicorn`实现。-- 该模块定位是一个快速搭建示例的demo,没有考虑多进程处理并发请求,如果有这需求的小伙伴,可以看看gunicorn等。--### 使用步骤-1. 安装`rapidocr_api`- ```bash- $ pip install rapidocr_api-- # 源码安装- $ python setup.py bdist_wheel v0.0.1- $ cd dist- $ pip install rapidocr_*.whl- ```-2. 运行- - 用法:- ```bash- $ rapidocr_api -h- usage: rapidocr_api [-h] [-ip IP] [-p PORT]-- optional arguments:- -h, --help show this help message and exit- -ip IP, --ip IP IP Address- -p PORT, --port PORT IP port- ```- - 示例:- ```bash- $ rapidocr_api -ip 0.0.0.0 -p 9003- ```-3. 使用- - ⚠️:本质就是发送一个POST请求,其他语言同理- - curl调用- ```bash- $ curl -F [email protected] http://0.0.0.0:9003/ocr- ```- - python调用- - 以文件的方式发送请求- ```python- import requests-- url = 'http://localhost:9003/ocr'- img_path = '../python/tests/test_files/ch_en_num.jpg'-- with open(img_path, 'rb') as f:- file_dict = {'image_file': (img_path, f, 'image/png')}- response = requests.post(url, files=file_dict, timeout=60)-- print(response.json())- ```- - 以`base64`方式发送post请求- ```python- import base64- import requests-- url = 'http://localhost:9003/ocr'- img_path = '../python/tests/test_files/ch_en_num.jpg'-- with open(img_path, 'rb') as fa:- img_str = base64.b64encode(fa.read())-- payload = {'image_data': img_str}- resp = requests.post(url, data=payload)-- print(resp.json())- ```-4. API输出- - 示例结果:- <details>- <summary>详情</summary>-- ```json- {- "0": {- "rec_txt": "8月26日!",- "dt_boxes": [- [333.0, 72.0],- [545.0, 40.0],- [552.0, 90.0],- [341.0, 122.0]- ],- "score": "0.7342076812471662"- },- "1": {- "rec_txt": "澳洲名校招生信息",- "dt_boxes": [- [266.0, 163.0],- [612.0, 116.0],- [619.0, 163.0],- [272.0, 210.0]- ],- "score": "0.8261737492349412"- },- "2": {- "rec_txt": "解读!!",- "dt_boxes": [- [341.0, 187.0],- [595.0, 179.0],- [598.0, 288.0],- [344.0, 296.0]- ],- "score": "0.6152311325073242"- },- "3": {- "rec_txt": "Rules...",- "dt_boxes": [- [446.0, 321.0],- [560.0, 326.0],- [559.0, 352.0],- [445.0, 347.0]- ],- "score": "0.8704230123096042"- }- }- ```- </details>-- - 输出结果说明:- - 如果图像中存在文字,则会输出字典格式,具体介绍如下:- ```python- {- "0": {- "rec_txt": "香港深圳抽血,", # 识别的文本- "dt_boxes": [ # 依次为左上角 → 右上角 → 右下角 → 左下角- [265, 18],- [472, 231],- [431, 271],- [223, 59]- ],- "score": "0.8175641223788261" # 置信度- }- }- ```- - 如果没有检测到文字,则会输出空json(`{}`)。-5. **!!说明:OCR的输出结果为最原始结果,大家可按需进一步扩展。**+### See [Documentation](https://rapidai.github.io/RapidOCRDocs/docs/install_usage/rapidocr_api/)diff --git a/docs/doc_whl_rapidocr_api.md b/docs/doc_whl_rapidocr_api.mdindex 3a9825d..7cf717f 100644--- a/docs/doc_whl_rapidocr_api.md+++ b/docs/doc_whl_rapidocr_api.md@@ -1,135 +1 @@-## rapidocr-api-<p>- <a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a>- <a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>- <a href="https://pypi.org/project/rapidocr-api/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr-api"></a>- <a href="https://pepy.tech/project/rapidocr_api"><img src="https://static.pepy.tech/personalized-badge/rapidocr_api?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads"></a>-</p>--### Use-1. Install`rapidocr_api`- ```bash- $ pip install rapidocr_api- ```-2. Run- - Usage:- ```bash- $ rapidocr_api -h- usage: rapidocr_api [-h] [-ip IP] [-p PORT]-- optional arguments:- -h, --help show this help message and exit- -ip IP, --ip IP IP Address- -p PORT, --port PORT IP port- ```- - Example:- ```bash- $ rapidocr_api -ip 0.0.0.0 -p 9003- ```-3. Use- - with curl- ```bash- $ curl -F [email protected] http://0.0.0.0:9003/ocr- ```- - with python- - Send image data by file format.- ```python- import requests-- url = 'http://localhost:9003/ocr'- img_path = '../python/tests/test_files/ch_en_num.jpg'-- with open(img_path, 'rb') as f:- file_dict = {'image_file': (img_path, f, 'image/png')}- response = requests.post(url, files=file_dict, timeout=60)-- print(response.json())- ```- - Send image data by base64 format.- ```python- import base64- import requests-- url = 'http://localhost:9003/ocr'- img_path = '../python/tests/test_files/ch_en_num.jpg'-- with open(img_path, 'rb') as fa:- img_str = base64.b64encode(fa.read())-- payload = {'image_data': img_str}- resp = requests.post(url, data=payload)-- print(resp.json())- ```-4. Output- <details>- <summary>Click to expand</summary>-- ```json- {- "0": {- "rec_txt": "香港深圳抽血,",- "dt_boxes": [- [265, 18],- [472, 231],- [431, 271],- [223, 59]- ],- "score": "0.8175641223788261"- },- "1": {- "rec_txt": "专业查性别",- "dt_boxes": [- [388, 15],- [636, 257],- [587, 307],- [339, 65]- ],- "score": "0.8293875356515249"- },- "2": {- "rec_txt": "专业鉴定B超单",- "dt_boxes": [- [215, 84],- [509, 413],- [453, 463],- [159, 134]- ],- "score": "0.8626169338822365"- },- "3": {- "rec_txt": "b超仪器查性别",- "dt_boxes": [- [128, 135],- [430, 478],- [366, 534],- [64, 192]- ],- "score": "0.8449362441897392"- },- "4": {- "rec_txt": "加微信eee",- "dt_boxes": [- [58, 189],- [268, 450],- [209, 498],- [0, 236]- ],- "score": "0.8176911813872201"- },- "5": {- "rec_txt": "可邮寄",- "dt_boxes": [- [493, 261],- [617, 384],- [577, 423],- [454, 300]- ],- "score": "0.7494261413812637"- }- }- ```- </details>---### See details for [RapidOCR](https://github.com/RapidAI/RapidOCR/tree/main/ocrweb).\ No newline at end of file+### See [Documentation](https://rapidai.github.io/RapidOCRDocs/docs/install_usage/rapidocr_api/)diff --git a/docs/doc_whl_rapidocr_ort.md b/docs/doc_whl_rapidocr_ort.mdindex 2d89a6a..5725106 100644--- a/docs/doc_whl_rapidocr_ort.md+++ b/docs/doc_whl_rapidocr_ort.md@@ -1,8 +1 @@-## rapidocr-onnxruntime-<p>- <a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a>- <a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>- <a href="https://pepy.tech/project/rapidocr_onnxruntime"><img src="https://static.pepy.tech/personalized-badge/rapidocr_onnxruntime?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads%20Ort"></a>-</p>--### See [Documentation](https://rapidai.github.io/RapidOCRDocs/docs/install_usage/rapidocr/rapidocr_onnxruntime/)+### See [Documentation](https://rapidai.github.io/RapidOCRDocs/docs/install_usage/rapidocr/usage/)diff --git a/docs/doc_whl_rapidocr_vino.md b/docs/doc_whl_rapidocr_vino.mdindex 1f6121c..5725106 100644--- a/docs/doc_whl_rapidocr_vino.md+++ b/docs/doc_whl_rapidocr_vino.md@@ -1,8 +1 @@-## rapidocr-openvino-<p>- <a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a>- <a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>- <a href="https://pepy.tech/project/rapidocr_openvino"><img src="https://static.pepy.tech/personalized-badge/rapidocr_openvino?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads%20Vino"></a>-</p>--### See [Documentation](https://rapidai.github.io/RapidOCRDocs/docs/install_usage/rapidocr/rapidocr_openvino/)+### See [Documentation](https://rapidai.github.io/RapidOCRDocs/docs/install_usage/rapidocr/usage/)diff --git a/docs/doc_whl_rapidocr_web.md b/docs/doc_whl_rapidocr_web.mdindex 983c726..e8c8a2e 100644--- a/docs/doc_whl_rapidocr_web.md+++ b/docs/doc_whl_rapidocr_web.md@@ -1,31 +1 @@-## rapidocr-web-<p>- <a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a>- <a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>- <a href="https://pypi.org/project/rapidocr-web/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr-web"></a>- <a href="https://pepy.tech/project/rapidocr_web"><img src="https://static.pepy.tech/personalized-badge/rapidocr_web?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads"></a>-</p>--### use-1. Install package by pypi.- ```bash- $ pip install rapidocr-web- ```-2. Run by command line.- - Usage:- ```bash- $ rapidocr_web -h- usage: rapidocr_web [-h] [-ip IP] [-p PORT]-- optional arguments:- -h, --help show this help message and exit- -ip IP, --ip IP IP Address- -p PORT, --port PORT IP port- ```- - Example:- ```bash- $ rapidocr_web -ip "0.0.0.0" -p 9003- ```-3. Open `http://localhost:9003/` to view, enjoy it.--### See details for [RapidOCR](https://github.com/RapidAI/RapidOCR/tree/main/ocrweb).\ No newline at end of file+### See [Documentation](https://rapidai.github.io/RapidOCRDocs/docs/install_usage/rapidocr_web/rapidocr_web/)diff --git a/ocrweb/README.md b/ocrweb/README.mdindex e8fe23f..e8c8a2e 100755--- a/ocrweb/README.md+++ b/ocrweb/README.md@@ -1,53 +1 @@-## RapidOCR Web Demo--<p>- <a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a>- <a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>- <a href="https://pypi.org/project/rapidocr-web/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr-web"></a>- <a href="https://pepy.tech/project/rapidocr_web"><img src="https://static.pepy.tech/personalized-badge/rapidocr_web?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads"></a>-</p>---- [RapidOCR Web Demo](#rapidocr-web-demo)- - [简要说明](#简要说明)- - [桌面版使用教程](#桌面版使用教程)- - [界面版使用步骤](#界面版使用步骤)---### 简要说明-- 该模块依赖`rapidocr_onnxruntime`库。-- 如果想要离线部署,可以先手动下载[`rapidocr_onnxruntime`](https://pypi.org/project/rapidocr-onnxruntime/#files) whl包,再手动安装[`rapidocr_web`](https://pypi.org/project/rapidocr-web/#files) whl包来使用。-- 所用模型组合(最优组合)为:- ```text- ch_PP-OCRv3_det + ch_ppocr_mobile_v2.0_cls + ch_PP-OCRv3_rec- ```-- 网页上显示的推理时间具体解释如下:-- <div align="center">- <img src="https://github.com/RapidAI/RapidOCR/blob/ae529c2ba79e6cbf04c54caf2d24feb75e947ca4/assets/ocrweb_time.jpg" width="80%" height="80%">- </div>--### [桌面版使用教程](https://github.com/RapidAI/RapidOCR/wiki/%5BRapidOCRWeb%5D-%E6%A1%8C%E9%9D%A2%E7%89%88%E4%BD%BF%E7%94%A8%E6%95%99%E7%A8%8B)--### 界面版使用步骤-1. 安装`rapidocr_web`- ```bash- $ pip install rapidocr_web- ```-2. 运行- - 用法:- ```bash- $ rapidocr_web -h- usage: rapidocr_web [-h] [-ip IP] [-p PORT]-- optional arguments:- -h, --help show this help message and exit- -ip IP, --ip IP IP Address- -p PORT, --port PORT IP port- ```- - 示例:- ```bash- $ rapidocr_web -ip 0.0.0.0 -p 9003- ```-3. 使用- - 浏览器打开`http://localhost:9003/`,enjoy it.+### See [Documentation](https://rapidai.github.io/RapidOCRDocs/docs/install_usage/rapidocr_web/rapidocr_web/)diff --git a/ocrweb_multi/README.md b/ocrweb_multi/README.mdindex 8c0031c..140cbf7 100644--- a/ocrweb_multi/README.md+++ b/ocrweb_multi/README.md@@ -1,61 +1 @@-## RapidOCR Multilanguage Web Demo--### 简要说明-- 同时支持多种语言,可通过接口参数配置语言及预测过程中的其他参数-- 调整结果展示方式为基于canvas, 减少后端处理和接口数据传输-- 预测接口添加Token验证支持-- 添加pyinstaller打包脚本,简化安装步骤-- 示例打包结果:[pyinstaller demo](https://github.com/AutumnSun1996/RapidOCR/releases/tag/v1.1.1-ocrweb-multi)--### 运行步骤-1. 安装`requirements.txt`下相关包- ```shell- pip install -r requirements.txt -i https://pypi.douban.com/simple/- ```-2. 下载`models`文件到当前目录下- - 下载链接:[百度网盘](https://pan.baidu.com/s/1Z3v34wu0tE6lBndYyP0xOg?pwd=6urq) | [Google Drive](https://drive.google.com/drive/folders/1HZUzGplq_47xKmDVtplwrMmIjoHm7uKo?usp=sharing)- - 最终目录结构如下:- ```text- ocr_web_multi- |-- README.md- |-- build.py- |-- config.yaml- |-- main.py- |-- main.spec- |-- models- | |-- Multilingual_PP-OCRv3_det_infer.onnx- | |-- ch_PP-OCRv3_det_infer.onnx- | |-- ch_PP-OCRv3_rec_infer.meta.onnx- | |-- ch_ppocr_mobile_v2.0_cls_infer.meta.onnx- | |-- chinese_cht_PP-OCRv3_rec_infer.meta.onnx- | |-- en_PP-OCRv3_det_infer.onnx- | |-- en_PP-OCRv3_rec_infer.meta.onnx- | `-- japan_PP-OCRv3_rec_infer.meta.onnx- |-- rapidocr- | |-- __init__.py- | |-- classify.py- | |-- detect.py- | |-- detect_process.py- | |-- main.py- | |-- rapid_ocr_api.py- | `-- recognize.py- |-- requirements.txt- |-- static- | |-- css- | |-- favicon.ico- | |-- hint.svg- | |-- index.html- | `-- js- |-- utils- | |-- config.py- | `-- utils.py- |-- wrapper.c- `-- wrapper.rc- ```-3. 运行`main.py`- ```shell- python main.py- ```-4. 打开`http://127.0.0.1:8001`即可, enjoy it!-- \ No newline at end of file+### See [Documentation](https://rapidai.github.io/RapidOCRDocs/docs/install_usage/rapidocr_web/ocrweb_multi/)diff --git a/python/README.md b/python/README.mdindex 0f0ce29..763ee04 100755--- a/python/README.md+++ b/python/README.md@@ -1,245 +1 @@-## RapidOCR Python-<p>- <a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a>- <a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>- <a href="https://pepy.tech/project/rapidocr_onnxruntime"><img src="https://static.pepy.tech/personalized-badge/rapidocr_onnxruntime?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads%20Ort"></a>- <a href="https://pepy.tech/project/rapidocr_openvino"><img src="https://static.pepy.tech/personalized-badge/rapidocr_openvino?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads%20Vino"></a>-</p>--<details open>-<summary>目录</summary>--- [RapidOCR Python](#rapidocr-python)- - [简介](#简介)- - [说明](#说明)- - [pip安装快速使用(推荐)](#pip安装快速使用推荐)- - [源码使用步骤](#源码使用步骤)-</details>--### 简介-- 该部分为python版的OCR推理,包括基于ONNXRuntime和OpenVINO两个推理引擎的包。-- 因为模型较小,因此将相关模型都已打到Whl包,可直接pip安装使用。--### 说明-- `rapidocr_onnxruntime`和`rapidocr_openvino`两个包除推理引擎不同之外,其余均相同,默认都是在CPU上运行。-- 按语义版本号来讲,两个包其主版本号和次版本号同步更新,修订号可能会有区别。也就是说`x.y.z`中`x`和`y`是一样的,`z`可能不同。-- 各个版本的对应关系:- |版本|内置模型版本|对应PaddleOCR 分支|- |:---:|:---:|:---:|- |`v1.3.x`|PaddleOCR v4版| [release/2.7](https://github.com/PaddlePaddle/PaddleOCR/tree/release/2.7)|- |`v1.2.x`<br/>`v1.1.x`<br/>`v1.0.x`|PaddleOCR v3版| [release/2.6](https://github.com/PaddlePaddle/PaddleOCR/tree/release/2.6)|-- 推荐使用[PaddleOCRModelConveter](https://github.com/RapidAI/PaddleOCRModelConverter)在线转换,现用现转。推理代码都是同一个,只需更换模型即可。已转好**ONNX模型下载地址:**[百度网盘](https://pan.baidu.com/s/1PTcgXG2zEgQU6A_A3kGJ3Q?pwd=jhai) | [Google Drive](https://drive.google.com/drive/folders/1x_a9KpCo_1blxH1xFOfgKVkw1HYRVywY?usp=sharing),大家可自行搭配使用。-- 所有常用的参数配置都在[`config.yaml`](https://github.com/RapidAI/RapidOCR/blob/main/python/rapidocr_onnxruntime/config.yaml)下,其中每个独立的模块下均有独立的`config.yaml`配置文件,可以单独使用。-- 关于选择哪个版本的包(`rapidocr_onnxruntime` 或者 `rapidocr_openvino`)?- |推理引擎|推理速度更快|占用内存更少|- |:---:|:---:|:---:|- |`rapidocr_onnxruntime`||✓|- |`rapidocr_openvino`|✓|⚠️ openvino存在内存不释放的问题,参见[wiki](https://github.com/RapidAI/RapidOCR/wiki/openvino%E5%85%A5%E9%97%A8)|---### pip安装快速使用(推荐)-1. 安装环境- |包名|版本|安装命令|- |:---|:---:|:---|- |`rapidocr_onnxruntime`|<a href="https://pypi.org/project/rapidocr-onnxruntime/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr-onnxruntime?style=flat-square"></a>|`pip install rapidocr-onnxruntime`|- |`rapidocr_openvino`|<a href="https://pypi.org/project/rapidocr-openvino/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr-openvino?style=flat-square"></a>|`pip install rapidocr-openvino`|--2. python脚本使用- - ⚠️注意:初始化RapidOCR可不提供`config.yaml`,默认使用安装目录下的`config.yaml`。如有自定义需求:- - 一是可直接通过初始化参数传入。详细参数参考下面命令行部分,和`config.yaml`基本对应。- - 二是复制`config.yaml`,自行更改,然后初始化给出。e.g. `engine = RapidOCR(config_path="custom.yaml")`-- - 输入:`Union[str, np.ndarray, bytes, Path]`- - 输出:- - 有值:`([[文本框坐标], 文本内容, 置信度], 推理时间)`,e.g. `[[左上, 右上, 右下, 左下], '小明', '0.99'], [0.02, 0.02, 0.85]`- - 为空:`(None, None)`- - 示例:- ```python- import cv2- from rapidocr_onnxruntime import RapidOCR- # from rapidocr_openvino import RapidOCR-- # RapidOCR可传入参数参考下面的命令行部分- rapid_ocr = RapidOCR()-- img_path = 'tests/test_files/ch_en_num.jpg'-- # 输入格式一:str- result, elapse = rapid_ocr(img_path)-- # 输入格式二:np.ndarray- img = cv2.imread('tests/test_files/ch_en_num.jpg')- result, elapse = rapid_ocr(img)-- # 输入格式三:bytes- with open(img_path, 'rb') as f:- img = f.read()- result, elapse = rapid_ocr(img)-- # 输入格式四:Path- result, elapse = rapid_ocr(Path(img_path))- print(result)- ```--3. 命令行使用- - 参数说明:- ```bash- $ rapidocr_onnxruntime -h- usage: rapidocr_onnxruntime [-h] -img IMG_PATH [-p] [--text_score TEXT_SCORE]- [--use_angle_cls USE_ANGLE_CLS]- [--use_text_det USE_TEXT_DET]- [--print_verbose PRINT_VERBOSE]- [--min_height MIN_HEIGHT]- [--width_height_ratio WIDTH_HEIGHT_RATIO]- [--det_use_cuda DET_USE_CUDA]- [--det_model_path DET_MODEL_PATH]- [--det_limit_side_len DET_LIMIT_SIDE_LEN]- [--det_limit_type {max,min}]- [--det_thresh DET_THRESH]- [--det_box_thresh DET_BOX_THRESH]- [--det_unclip_ratio DET_UNCLIP_RATIO]- [--det_use_dilation DET_USE_DILATION]- [--det_score_mode {slow,fast}]- [--cls_use_cuda CLS_USE_CUDA]- [--cls_model_path CLS_MODEL_PATH]- [--cls_image_shape CLS_IMAGE_SHAPE]- [--cls_label_list CLS_LABEL_LIST]- [--cls_batch_num CLS_BATCH_NUM]- [--cls_thresh CLS_THRESH]- [--rec_use_cuda REC_USE_CUDA]- [--rec_model_path REC_MODEL_PATH]- [--rec_img_shape REC_IMAGE_SHAPE]- [--rec_batch_num REC_BATCH_NUM]-- optional arguments:- -h, --help show this help message and exit- -img IMG_PATH, --img_path IMG_PATH MUST- -p, --print_cost-- Global:- --text_score TEXT_SCORE- --use_angle_cls USE_ANGLE_CLS- --use_text_det USE_TEXT_DET- --print_verbose PRINT_VERBOSE- --min_height MIN_HEIGHT- --width_height_ratio WIDTH_HEIGHT_RATIO-- Det:- --det_use_cuda DET_USE_CUDA- --det_model_path DET_MODEL_PATH- --det_limit_side_len DET_LIMIT_SIDE_LEN- --det_limit_type {max,min}- --det_thresh DET_THRESH- --det_box_thresh DET_BOX_THRESH- --det_unclip_ratio DET_UNCLIP_RATIO- --det_use_dilation DET_USE_DILATION- --det_score_mode {slow,fast}-- Cls:- --cls_use_cuda CLS_USE_CUDA- --cls_model_path CLS_MODEL_PATH- --cls_image_shape CLS_IMAGE_SHAPE- --cls_label_list CLS_LABEL_LIST- --cls_batch_num CLS_BATCH_NUM- --cls_thresh CLS_THRESH-- Rec:- --rec_use_cuda REC_USE_CUDA- --rec_model_path REC_MODEL_PATH- --rec_img_shape REC_IMAGE_SHAPE- --rec_batch_num REC_BATCH_NUM- ```- - 示例:- ```bash- $ rapidocr_onnxruntime -img tests/test_files/ch_en_num.jpg- ```--### 源码使用步骤--<details>--1. 下载整个项目到本地- ```shell- cd RapidOCR/python- ```--2. 下载链接下的`resources`目录(包含模型和显示的字体文件)- - 下载链接:[百度网盘](https://pan.baidu.com/s/1PTcgXG2zEgQU6A_A3kGJ3Q?pwd=jhai) | [Google Drive](https://drive.google.com/drive/folders/1x_a9KpCo_1blxH1xFOfgKVkw1HYRVywY?usp=sharing)- - 最终目录如下,自行比对:- ```text- .- ├── README.md- ├── demo.py- ├── rapidocr_onnxruntime- │ ├── __init__.py- │ ├── ch_ppocr_v2_cls- │ ├── ch_ppocr_v3_det- │ ├── ch_ppocr_v3_rec- │ ├── config.yaml- │ ├── rapid_ocr_api.py- │ └── models- │ ├── ch_PP-OCRv3_det_infer.onnx- │ ├── ch_ppocr_mobile_v2.0_cls_infer.onnx- │ └── ch_PP-OCRv3_rec_infer.onnx- ├── rapidocr_openvino- │ ├── __init__.py- │ ├── README.md- │ ├── ch_ppocr_v2_cls- │ ├── ch_ppocr_v3_det- │ ├── ch_ppocr_v3_rec- │ ├── config.yaml- │ ├── rapid_ocr_api.py- │ └── models- │ ├── ch_PP-OCRv3_det_infer.onnx- │ ├── ch_ppocr_mobile_v2.0_cls_infer.onnx- │ └── ch_PP-OCRv3_rec_infer.onnx- ├── requirements.txt- └── resources- └── fonts- └── FZYTK.TTF- ```--3. 安装运行环境- - 基于onnxruntime推理所需环境安装:- ```bash- pip install onnxruntime>=1.7.0- pip install -r requirements.txt- ```- - 基于openvino推理所需环境安装:- ```bash- pip install openvino- pip install -r requirements.txt- ```- - ⚠️: 在Windows端,Shapely库自动安装可能会有问题,解决方案参见[Q15](https://github.com/RapidAI/RapidOCR/blob/main/docs/FAQ.md#q-windows系统下装完环境之后运行示例程序之后报错oserror-winerror-126-找不到指定的模組)--4. 运行示例- - 运行单元测试- ```bash- pytest tests/test_*.py- ```- - 接口调用- ```python- import cv2-- # 基于onnxruntime引擎推理- from rapidocr_onnxruntime import RapidOCR-- # 基于openvino引擎推理- # from rapidocr_openvino import RapidOCR-- rapid_ocr = RapidOCR()-- image_path = r'test_images/det_images/ch_en_num.jpg'- img = cv2.imread(image_path)-- result = rapid_ocr(img)- print(result)-- # result: [[文本框坐标], 文本内容, 置信度]- # 示例:[[左上, 右上, 右下, 左下], '小明', '0.99']- ```- - 直接运行`demo.py`,可直接可视化查看结果。- ```bash- python demo.py- ```-</details>\ No newline at end of file+### See [Documentation](https://rapidai.github.io/RapidOCRDocs/docs/install_usage/rapidocr/install/)