Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL authored Mar 11, 2023
1 parent 6bb2b79 commit 753f2b2
Showing 1 changed file with 22 additions and 39 deletions.
61 changes: 22 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- 输入:推理模型的url或者本地tar路径
- 输出:转换后的ONNX模型
- 如果是识别模型,需要提供对应字典的原始txt路径(**打开github中txt文件,点击右上角raw之后的路径**),用来将字典写入到onnx模型中
- 搭配[RapidOCR](https://github.com/RapidAI/RapidOCR)中相关推理代码使用
- !!!需要搭配[RapidOCR](https://github.com/RapidAI/RapidOCR)中相关推理代码使用


### 使用步骤
Expand Down Expand Up @@ -78,51 +78,32 @@
converter(model_path, save_dir, txt_path=txt_path)
```
4. 使用模型方法(暂定):
1. 下载RapidOCR仓库源码([RapidOCR](https://github.com/RapidAI/RapidOCR))
2. 切换到**python**目录下
```text
.
├── demo.py
├── inference_results
├── rapidocr_onnxruntime
│ ├── ch_ppocr_v2_cls
│ ├── ch_ppocr_v3_det
│ ├── ch_ppocr_v3_rec
│ ├── config.yaml # 这个是配置文件
│ ├── __init__.py
│ ├── models # 新转换的模型放在这里
│ │ ├── ch_ppocr_mobile_v2.0_cls_infer.onnx
│ │ ├── ch_PP-OCRv3_det_infer.onnx
│ │ └── ch_PP-OCRv3_rec_infer.onnx
│ ├── rapid_ocr_api.py
│ └── utils.py
├── rapidocr_openvino
├── rapid_structure
├── README.md
├── requirements.txt
├── resources
├── setup_onnxruntime.py
├── setup_openvino.py
└── tests
4. 使用模型方法:
- 假设要用日文识别模型,且已经转好,路径为`local/models/japan.onnx`
1. 安装`rapidocr_onnxruntime`
```bash
pip install rapidocr_onnxruntime
```
3. 更改配置文件**config.yaml**中对应模型路径即可
```yaml
Det:
model_path: models/ch_PP-OCRv3_det_infer.onnx
Cls:
model_path: models/ch_ppocr_mobile_v2.0_cls_infer.onnx
Rec:
model_path: models/ch_PP-OCRv3_rec_infer.onnx
2. 脚本使用
```python
from rapidocr_onnxruntime import RapidOCR

model_path = 'local/models/japan.onnx'
engine = RapidOCR(rec_model_path=model_path)

img = '1.jpg'
result, elapse = engine(img)
```
4. 运行demo
3. 命令行使用
```bash
# RapidOCR/python
python demo.py
$ rapidocr_onnxruntime -img 1.jpg --rec_model_path local/models/japan.onnx
```
### 更新日志
<details>
- 2023-03-05 v0.0.4~7 update:
- 支持对本地的模型和字典转写
- 优化内部逻辑和错误反馈
Expand All @@ -135,3 +116,5 @@
- 2022-08-15 v0.0.1 update:
- 将识别模型的字典写入到onnx模型中的meta中,便于后续分发。
</details>

0 comments on commit 753f2b2

Please sign in to comment.