Skip to content

📄 Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.

add server text rec model

SWHL984ea1816fb1
diff --git a/README.md b/README.md
index 81ba91b..a4ff73a 100755
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@
- [RapidOCR (捷智OCR)](#rapidocr-捷智ocr)
- [简介](#简介)
- [近期更新](#近期更新)
+ - [🎉🎉🎉2021-06-10 update](#2021-06-10-update)
- [2021-06-08 update](#2021-06-08-update)
- [2021-03-24 update](#2021-03-24-update)
- [整个框架](#整个框架)
@@ -46,6 +47,10 @@
- 基于百度的开源PaddleOCR 模型及训练,任何人可以使用本推理库,也可以根据自己的需求使用百度的paddlepaddle 框架进行模型优化。
## 近期更新
+
+#### 🎉🎉🎉2021-06-10 update
+- 添加server版文本识别模型,详情见[提取码:30jv](https://pan.baidu.com/s/1qkqWK4wRdMjqGGbzR-FyWg)
+
#### 2021-06-08 update
- 整理仓库,统一模型下载路径
- 完善相关说明文档
diff --git a/python/README.md b/python/README.md
index 12b3a55..f7be42b 100755
--- a/python/README.md
+++ b/python/README.md
@@ -1,3 +1,6 @@
+### 🎉2021-06-10 update:
+- 添加server版文本识别模型,详情见[提取码:30jv](https://pan.baidu.com/s/1qkqWK4wRdMjqGGbzR-FyWg)
+
### 2021-06-09 update:
- 添加字体文件到模型下载链接中
diff --git a/python/rapidOCR.py b/python/rapidOCR.py
index 721d4d1..89e254f 100644
--- a/python/rapidOCR.py
+++ b/python/rapidOCR.py
@@ -227,8 +227,6 @@ def main():
if __name__ == '__main__':
parser = argparse.ArgumentParser()
- parser.add_argument('--use_server', type=str2bool, default=False)
-
parser.add_argument('--det_model_path', type=str,
default='models/ch_ppocr_mobile_v2.0_det_infer.onnx')
parser.add_argument('--cls_model_path', type=str,
@@ -240,30 +238,17 @@ if __name__ == '__main__':
default='test_images/det_images/1.jpg')
args = parser.parse_args()
- if args.use_server:
- from ch_ppocr_mobile_v2_cls import TextClassifier
- from ch_ppocr_server_v2_det import TextDetector
- from ch_ppocr_server_v2_rec import TextRecognizer
-
- if not args.det_model_path.__contains__('server'):
- raise ValueError(f'det模型{args.det_model_path}不是通用模型!')
+ from ch_ppocr_mobile_v2_cls import TextClassifier
- if not args.rec_model_path.__contains__('server'):
- raise ValueError(f'rec模型{args.rec_model_path}不是通用模型!')
+ if args.det_model_path.find('server') != -1:
+ from ch_ppocr_server_v2_det import TextDetector
else:
- # v2.0 超轻量
- from ch_ppocr_mobile_v2_cls import TextClassifier
from ch_ppocr_mobile_v2_det import TextDetector
- from ch_ppocr_mobile_v2_rec import TextRecognizer
-
- if args.det_model_path is None:
- raise FileNotFoundError(f'{args.det_model_path} is not found!')
-
- if args.cls_model_path is None:
- raise FileNotFoundError(f'{args.cls_model_path} is not found!')
- if args.rec_model_path is None:
- raise FileNotFoundError(f'{args.rec_model_path} is not found!')
+ if args.rec_model_path.find('server') != -1:
+ from ch_ppocr_server_v2_rec import TextRecognizer
+ else:
+ from ch_ppocr_mobile_v2_rec import TextRecognizer
text_sys = TextSystem(args.det_model_path,
args.rec_model_path,
diff --git a/python/rapidOCR.sh b/python/rapidOCR.sh
index d0148f1..8a228a5 100644
--- a/python/rapidOCR.sh
+++ b/python/rapidOCR.sh
@@ -1,8 +1,7 @@
#! /bin/bash
set -e errexit
-python rapidOCR.py --use_server False \
- --det_model_path models/ch_ppocr_mobile_v2.0_det_infer.onnx \
+python rapidOCR.py --det_model_path models/ch_ppocr_mobile_v2.0_det_infer.onnx \
--cls_model_path models/ch_ppocr_mobile_v2.0_cls_infer.onnx \
--rec_model_path models/ch_ppocr_mobile_v2.0_rec_infer.onnx \
--image_path test_images/det_images/1.jpg