Skip to content

Commit f177d79

Browse files
committed
docs: update files
1 parent 711928e commit f177d79

2 files changed

Lines changed: 32 additions & 11 deletions

File tree

docs/install_usage/rapidocr/how_to_use_offline_model.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,44 @@ hide:
44
- toc
55
---
66

7-
使用方法同样也是有两种:一是通过配置文件传入;二是通过初始化参数传入。
7+
使用方法同样也是有两种:一是通过配置文件传入;二是通过初始化参数传入。文本检测、方向分类模型和文本识别模型均有对应的 `model_path` 参数。
88

9-
!!! tip
9+
### PaddlePaddle 格式离线模型指定
1010

11-
Paddle 格式模型需要使用 `model_dir` 来传入。原因是 Paddle 格式模型为多个文件组成,需要在程序中拼接为对应完整路径。
11+
```python linenums="1" hl_lines="4"
12+
from rapidocr import RapidOCR
1213

13-
下面以通过初始化参数传入为例:
14+
# 以指定 PP-OCRv6 Rec Tiny 模型为例
15+
model_path = "modelscope/paddle/PP-OCRv6/rec/PP-OCRv6_rec_tiny"
16+
dict_path = "modelscope/paddle/PP-OCRv6/rec/PP-OCRv6_rec_tiny/ppocrv6_tiny_dict.txt"
17+
engine = RapidOCR(
18+
params={
19+
"Rec.model_dir": model_path,
20+
"Rec.rec_keys_path": dict_path,
21+
"Rec.engine_type": EngineType.PADDLE,
22+
"Rec.ocr_version": OCRVersion.PPOCRV5,
23+
}
24+
)
25+
26+
img_url = "https://img1.baidu.com/it/u=3619974146,1266987475&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=516"
27+
result = engine(img_url)
28+
print(result)
29+
30+
result.vis("vis_result.jpg")
31+
```
32+
33+
### PaddlePaddle 格式以外离线模型指定
1434

1535
```python linenums="1" hl_lines="4"
1636
from rapidocr import RapidOCR
1737

38+
model_path = "torch/PP-OCRv6/det/PP-OCRv6_det_tiny.pth"
1839
engine = RapidOCR(
19-
params={"Det.model_path": "models/ch_PP-OCRv4_det_infer.onnx"}
40+
params={
41+
"Det.ocr_version": OCRVersion.PPOCRV6,
42+
"Det.model_path": model_path,
43+
"Det.engine_type": EngineType.TORCH,
44+
}
2045
)
2146

2247
img_url = "https://img1.baidu.com/it/u=3619974146,1266987475&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=516"
@@ -25,5 +50,3 @@ print(result)
2550

2651
result.vis("vis_result.jpg")
2752
```
28-
29-
上面第 4 行通过 `Det.model_path` 指定了本地已经下载好的文本检测模型。文本方向分类和文本识别模型也可同样指定。(`Cls.model_path``Rec.model_path` 同理)

docs/model_list.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ hide:
120120

121121
|语种类型|engine_type| lang_type|model_type|ocr_version|
122122
|:---|:---|:---|:---|:---|
123-
|多语种|`onnxruntime`(`rapidocr==3.9.0`) <br/> `openvino` (`rapidocr==3.9.0`)|`ch`<br/>`en`<br/>`multi`<br/>|`tiny`<br/> `small`<br/>`medium`|`PP-OCRv6`|
123+
|多语种|`onnxruntime`(`rapidocr>=3.9.0`) <br/> `openvino` (`rapidocr>=3.9.0`) <br/> `paddle` (`rapidocr>=3.9.1`) <br/>`torch` (`rapidocr>=3.9.1`)<br/>`mnn` (`rapidocr>=3.9.1`)<br/> ❎ `tensorrt`|`ch`<br/>`en`<br/>`multi`<br/>|`tiny`<br/> `small`<br/>`medium`|`PP-OCRv6`|
124124

125125
`medium``small` 模型支持的语种:`ch, chinese_cht, en, japan, af, az, bs, ca, cs, cy, da, de, es, et, eu, fi, fr, ga, gl, hr, hu, id, is, it, ku, la, lb, lt, lv, mi, ms, mt, nl, no, oc, pl, pt, qu, rm, ro, rs_latin, sk, sl, sq, sv, sw, tl, tr, uz, vi, french, german`
126126

@@ -191,11 +191,9 @@ engine = RapidOCR(
191191

192192
#### PP-OCRv6
193193

194-
> `rapidocr>=3.9.0` 支持。
195-
196194
| 语种类型 | engine_type | lang_type | model_type | ocr_version |
197195
|----------------|---------------------------|-------------------|-----------------|-------------------|
198-
| 多语种 | `onnxruntime`<br>`openvino`| `ch` | `tiny`<br/> `small`<br/>`medium` | `PP-OCRv6` |
196+
| 多语种 | `onnxruntime`(`rapidocr>=3.9.0`) <br/> `openvino` (`rapidocr>=3.9.0`) <br/> `paddle` (`rapidocr>=3.9.1`) <br/>`torch` (`rapidocr>=3.9.1`)<br/>`mnn` (`rapidocr>=3.9.1`)<br/> ❎ `tensorrt`| `ch` | `tiny`<br/> `small`<br/>`medium` | `PP-OCRv6` |
199197

200198
`medium``small` 模型支持的语种:`ch, chinese_cht, en, japan, af, az, bs, ca, cs, cy, da, de, es, et, eu, fi, fr, ga, gl, hr, hu, id, is, it, ku, la, lb, lt, lv, mi, ms, mt, nl, no, oc, pl, pt, qu, rm, ro, rs_latin, sk, sl, sq, sv, sw, tl, tr, uz, vi, french, german`
201199

0 commit comments

Comments
 (0)