Skip to content

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

Update README

SWHL354fa500d565
diff --git a/python/openvino_infer/README.md b/python/openvino_infer/README.md
index c29adba..2c87cd2 100644
--- a/python/openvino_infer/README.md
+++ b/python/openvino_infer/README.md
@@ -5,5 +5,16 @@ pip install openvino==2022.1.0
pip install openvino-dev==2022.1.0
```
+#### 模型转换为IR
+```bash
+# 转动态模型 占用内存平均为3.5G左右
+mo --input_model models/ch_PP-OCRv2_det_infer.onnx --output_dir models/IR/
+
+# 转静态模型 占用内存平均为1G左右
+mo --input_model models/ch_PP-OCRv2_det_infer.onnx \
+ --output_dir models/IR/static \
+ --input_shape 1,3, 12128,800
+```
+
#### 测试图像下载
- [long1.jpg](https://drive.google.com/file/d/1iJcGvOVIdUlyOS52bBdvO8uzx8QORo5M/view?usp=sharing)
diff --git a/python/openvino_infer/ch_ppocr_mobile_v2_det_openvino_ir/text_detect.py b/python/openvino_infer/ch_ppocr_mobile_v2_det_openvino_ir/text_detect.py
index 2816f12..3ade2ab 100644
--- a/python/openvino_infer/ch_ppocr_mobile_v2_det_openvino_ir/text_detect.py
+++ b/python/openvino_infer/ch_ppocr_mobile_v2_det_openvino_ir/text_detect.py
@@ -118,6 +118,7 @@ class TextDetector(object):
shape_list = np.expand_dims(shape_list, axis=0)
start_time = time.time()
+ print(img.shape)
self.vino_session.infer(inputs=[img])
vino_preds = self.vino_session.get_output_tensor().data
@@ -125,9 +126,6 @@ class TextDetector(object):
dt_boxes = post_result[0]['points']
dt_boxes = self.filter_tag_det_res(dt_boxes, ori_im.shape)
elapse = time.time() - start_time
-
- src_im = draw_text_det_res(dt_boxes, r'E:\PythonProjects\RapidOCR\python\test_images\long1.jpg')
- cv2.imwrite('det_results.jpg', src_im)
return dt_boxes, elapse
diff --git a/python/openvino_infer/test_openvino.py b/python/openvino_infer/test_openvino.py
index 308838b..bcb6725 100644
--- a/python/openvino_infer/test_openvino.py
+++ b/python/openvino_infer/test_openvino.py
@@ -36,7 +36,7 @@ import numpy as np
import cv2
from ch_ppocr_mobile_v2_det_openvino_ir import TextDetector as TextDetectorIR
-det_model_path = 'models/IR/FP16/ch_PP-OCRv2_det_infer.xml'
+det_model_path = 'models/IR/static/ch_PP-OCRv2_det_infer.xml'
img_path = 'test_images/long1.jpg'
img = cv2.imread(img_path)