|
8 | 8 |
|
9 | 9 | 在`rapidocr>=3.0.0`版本之后,`rapidocr`可以单独为文本检测、文本行方向分类和文本识别单独指定不同的推理引擎。 |
10 | 10 |
|
11 | | -例如:文本检测使用ONNXRuntime,文本识别使用Paddle(`params={"Rec.engine_type": EngineType.PADDLE}`)。同时,不同版本的OCR也可以通过`Det.ocr_version`灵活指定。 |
| 11 | +例如:文本检测使用ONNXRuntime,文本识别使用PaddlePaddle(`params={"Rec.engine_type": EngineType.PADDLE}`)。同时,不同版本的OCR也可以通过`Det.ocr_version`灵活指定。 |
12 | 12 |
|
13 | 13 | `rapidocr`支持4种推理引擎(**ONNXRuntime / OpenVINO / PaddlePaddle / PyTorch**),推荐首先使用 **ONNXRuntime CPU** 版。默认为ONNXRuntime。 |
14 | 14 |
|
15 | 15 | `rapidocr`是通过指定不同参数来选择使用不同的推理引擎的。当然,使用不同推理引擎的前提是事先安装好对应的推理引擎库,并确保安装正确。 |
16 | 16 |
|
17 | 17 | ### 使用ONNXRuntime |
18 | 18 |
|
19 | | -1. 安装ONNXRuntime。推荐用CPU版的ONNXRuntime,GPU版不推荐在`rapidocr`中使用,相关原因参见:[ONNXRuntime GPU推理](../../blog/posts/inference_engine/onnxruntime/onnxruntime-gpu.md) |
| 19 | +1. 安装ONNXRuntime。推荐用CPU版的ONNXRuntime,GPU版不推荐在`rapidocr`中使用,相关原因参见:[ONNXRuntime GPU推理](../../blog/posts/inference_engine/onnxruntime/onnxruntime-gpu.md)。 |
20 | 20 |
|
21 | 21 | ```bash linenums="1" |
22 | 22 | pip install onnxruntime |
|
42 | 42 |
|
43 | 43 | !!! tip |
44 | 44 |
|
45 | | - 仅在`rapidocr>=3.1.0`中支持。 |
46 | | - |
47 | | - ONNXRuntime官方相关文档:[link](https://onnxruntime.ai/docs/execution-providers/community-maintained/CANN-ExecutionProvider.html) |
| 45 | + 仅在`rapidocr>=3.1.0`中支持。ONNXRuntime官方相关文档:[link](https://onnxruntime.ai/docs/execution-providers/community-maintained/CANN-ExecutionProvider.html) |
48 | 46 |
|
49 | 47 | 1. 安装 |
50 | 48 |
|
@@ -106,13 +104,13 @@ hide: |
106 | 104 |
|
107 | 105 | ### 使用OpenVINO |
108 | 106 |
|
109 | | -1. 安装OpenVINO |
| 107 | +1. 安装OpenVINO。 |
110 | 108 |
|
111 | 109 | ```bash linenums="1" |
112 | 110 | pip install openvino |
113 | 111 | ``` |
114 | 112 |
|
115 | | -2. 指定OpenVINO作为推理引擎 |
| 113 | +2. 指定OpenVINO作为推理引擎。 |
116 | 114 |
|
117 | 115 | ```python linenums="1" hl_lines="5-7" |
118 | 116 | from rapidocr import RapidOCR, EngineType |
@@ -151,7 +149,7 @@ hide: |
151 | 149 |
|
152 | 150 | 大家可以根据实际情况,选择安装需要的版本。 |
153 | 151 |
|
154 | | -2. 指定PaddlePaddle作为推理引擎 |
| 152 | +2. 指定PaddlePaddle作为推理引擎。 |
155 | 153 |
|
156 | 154 | === "CPU" |
157 | 155 |
|
@@ -195,6 +193,10 @@ hide: |
195 | 193 |
|
196 | 194 | === "NPU" |
197 | 195 |
|
| 196 | + !!! tip |
| 197 | + |
| 198 | + 仅在`rapidocr>=3.3.0`中支持。对应版本的PaddlePaddle安装文档:[link](https://www.paddlepaddle.org.cn/install/quick?docurl=undefined) |
| 199 | + |
198 | 200 | ```python linenums="1" hl_lines="3-9" |
199 | 201 | from rapidocr import EngineType, RapidOCR |
200 | 202 |
|
@@ -230,11 +232,11 @@ hide: |
230 | 232 |
|
231 | 233 | 1. 安装PyTorch。 |
232 | 234 |
|
233 | | - 参见PyTorch官方安装文档 → [Install PyTorch](https://pytorch.org/#:~:text=and%20easy%20scaling.-,INSTALL%20PYTORCH,-Select%20your%20preferences) |
| 235 | + 参见PyTorch官方安装文档 → [Install PyTorch](https://pytorch.org/#:~:text=and%20easy%20scaling.-,INSTALL%20PYTORCH,-Select%20your%20preferences)。 |
234 | 236 |
|
235 | 237 | 大家可以根据实际情况,选择安装需要的版本。 |
236 | 238 |
|
237 | | -2. 指定PyTorch作为推理引擎 |
| 239 | +2. 指定PyTorch作为推理引擎。 |
238 | 240 |
|
239 | 241 | === "CPU" |
240 | 242 |
|
@@ -282,11 +284,9 @@ hide: |
282 | 284 |
|
283 | 285 | !!! tip |
284 | 286 |
|
285 | | - 仅在`rapidocr>3.4.0`中支持。 |
286 | | - |
287 | | - `torch_npu`官方相关文档:[link](https://github.com/Ascend/pytorch) |
| 287 | + 仅在`rapidocr>3.4.0`中支持。`torch_npu`官方相关文档:[link](https://github.com/Ascend/pytorch) |
288 | 288 |
|
289 | | - 1. 安装`torch_npu`,参见:[docs](https://github.com/Ascend/pytorch#installation) |
| 289 | + 1. 安装`torch_npu`,参见:[docs](https://github.com/Ascend/pytorch#installation)。 |
290 | 290 |
|
291 | 291 | 2. 使用 |
292 | 292 |
|
|
0 commit comments