π Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.
Add unit test of rec v3
SWHLd2690cdf857a
diff --git a/python/rapidocr_onnxruntime/ch_ppocr_v3_rec/config.yaml b/python/rapidocr_onnxruntime/ch_ppocr_v3_rec/config.yamlindex 2428429..c07c65b 100644--- a/python/rapidocr_onnxruntime/ch_ppocr_v3_rec/config.yaml+++ b/python/rapidocr_onnxruntime/ch_ppocr_v3_rec/config.yaml@@ -1,4 +1,4 @@-model_path: resources/models/PPOCRv3/ch_PP-OCRv3_rec_infer.onnx+model_path: resources/models/ch_PP-OCRv3_rec_infer.onnxuse_cuda: false# Details of the params: https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.htmldiff --git a/python/tests/test_rec_v2.py b/python/tests/test_rec_v2.pyindex 4a45ab6..0717ffa 100644--- a/python/tests/test_rec_v2.py+++ b/python/tests/test_rec_v2.py@@ -14,11 +14,11 @@ config = base.read_yaml(str(yaml_path))config['model_path'] = str(base.root_dir / config['model_path'])config['keys_path'] = str(base.root_dir / config['keys_path'])-text_cls = TextRecognizer(config)+text_rec = TextRecognizer(config)def test_rec():img_path = 'test_files/text_rec.jpg'img = cv2.imread(img_path)- rec_res, elapse = text_cls([img])+ rec_res, elapse = text_rec([img])assert rec_res[0][0] == 'ι©ε½ε°ι¦'diff --git a/python/tests/test_rec_v3.py b/python/tests/test_rec_v3.pynew file mode 100644index 0000000..69fef63--- /dev/null+++ b/python/tests/test_rec_v3.py@@ -0,0 +1,24 @@+# -*- encoding: utf-8 -*-+# @Author: SWHL+# @Contact: [email protected]+import base+import cv2+++module_name = 'ch_ppocr_v3_rec'+class_name = 'TextRecognizer'+TextRecognizer = base.init_module(module_name, class_name)++yaml_path = base.root_dir / base.package_name / module_name / 'config.yaml'+config = base.read_yaml(str(yaml_path))+config['model_path'] = str(base.root_dir / config['model_path'])+config['keys_path'] = str(base.root_dir / config['keys_path'])++text_rec = TextRecognizer(config)+++def test_rec():+ img_path = 'test_files/text_rec.jpg'+ img = cv2.imread(img_path)+ rec_res, elapse = text_rec([img])+ assert rec_res[0][0] == 'ι©ε½ε°ι¦'