Skip to content

πŸ“„ Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.

Remove the benchmark code

SWHL794f120ec4dd
diff --git a/python/tests/benchmark/benchmark.py b/python/tests/benchmark/benchmark.py
deleted file mode 100644
index 7afe023..0000000
--- a/python/tests/benchmark/benchmark.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- encoding: utf-8 -*-
-# @Author: SWHL
-# @Contact: [email protected]
-import argparse
-from pathlib import Path
-from tqdm import tqdm
-import sys
-import time
-
-cur_dir = Path(__file__).resolve().parent
-sys.path.append(str(cur_dir.parent.parent))
-
-import cv2
-from rapidocr_onnxruntime import RapidOCR
-
-
-if __name__ == "__main__":
- parser = argparse.ArgumentParser()
- parser.add_argument("--yaml_path", type=str, default="config.yaml")
- args = parser.parse_args()
-
- yaml_path = cur_dir / args.yaml_path
- rapid_ocr = RapidOCR(yaml_path)
-
- image_dir = cur_dir / "test_images_benchmark"
- if not image_dir.exists():
- raise FileNotFoundError(f"{image_dir} does not exits!!")
-
- image_list = list(image_dir.iterdir())
-
- cost_time_list = []
- for image_path in tqdm(image_list, desc="Test"):
- img = cv2.imread(str(image_path))
-
- start_time = time.time()
- result = rapid_ocr(img)
- elapse = time.time() - start_time
-
- cost_time_list.append(elapse)
-
- total_time = sum(cost_time_list)
- avg_time = total_time / len(cost_time_list)
- print(
- f"Total Files: {len(image_list)}, "
- f"Total Time: {total_time:.5f}, "
- f"Average Time: {avg_time:.5f}"
- )
diff --git a/python/tests/benchmark/config.yaml b/python/tests/benchmark/config.yaml
deleted file mode 100644
index fd7717e..0000000
--- a/python/tests/benchmark/config.yaml
+++ /dev/null
@@ -1,72 +0,0 @@
-Global:
- text_score: 0.5
- use_angle_cls: true
- print_verbose: true
- min_height: 30
- width_height_ratio: 8
-
-Det:
- module_name: ch_ppocr_v3_det
- class_name: TextDetector
- model_path: models/ch_PP-OCRv3_det_infer.onnx
-
- use_cuda: false
- # Details of the params: https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html
- CUDAExecutionProvider:
- device_id: 0
- arena_extend_strategy: kNextPowerOfTwo
- cudnn_conv_algo_search: EXHAUSTIVE
- do_copy_in_default_stream: true
-
- pre_process:
- DetResizeForTest:
- limit_side_len: 736
- limit_type: min
- NormalizeImage:
- std: [0.229, 0.224, 0.225]
- mean: [0.485, 0.456, 0.406]
- scale: 1./255.
- order: hwc
- ToCHWImage:
- KeepKeys:
- keep_keys: ['image', 'shape']
-
- post_process:
- thresh: 0.3
- box_thresh: 0.5
- max_candidates: 1000
- unclip_ratio: 1.6
- use_dilation: true
- score_mode: fast
-
-Cls:
- module_name: ch_ppocr_v2_cls
- class_name: TextClassifier
- model_path: models/ch_ppocr_mobile_v2.0_cls_infer.onnx
-
- use_cuda: false
- CUDAExecutionProvider:
- device_id: 0
- arena_extend_strategy: kNextPowerOfTwo
- cudnn_conv_algo_search: EXHAUSTIVE
- do_copy_in_default_stream: true
-
- cls_image_shape: [3, 48, 192]
- cls_batch_num: 6
- cls_thresh: 0.9
- label_list: ['0', '180']
-
-Rec:
- module_name: ch_ppocr_v3_rec
- class_name: TextRecognizer
- model_path: models/ch_PP-OCRv3_rec_infer.onnx
-
- use_cuda: false
- CUDAExecutionProvider:
- device_id: 0
- arena_extend_strategy: kNextPowerOfTwo
- cudnn_conv_algo_search: EXHAUSTIVE
- do_copy_in_default_stream: true
-
- rec_img_shape: [3, 48, 320]
- rec_batch_num: 6
diff --git a/python/tests/benchmark/config_gpu.yaml b/python/tests/benchmark/config_gpu.yaml
deleted file mode 100644
index 66d7a64..0000000
--- a/python/tests/benchmark/config_gpu.yaml
+++ /dev/null
@@ -1,71 +0,0 @@
-Global:
- text_score: 0.5
- use_angle_cls: true
- print_verbose: false
- min_height: 30
- width_height_ratio: 8
-
-Det:
- module_name: ch_ppocr_v3_det
- class_name: TextDetector
- model_path: models/ch_PP-OCRv3_det_infer.onnx
-
- use_cuda: true
- # Details of the params: https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html
- CUDAExecutionProvider:
- device_id: 0
- arena_extend_strategy: kNextPowerOfTwo
- cudnn_conv_algo_search: EXHAUSTIVE
- do_copy_in_default_stream: true
-
- pre_process:
- DetResizeForTest:
- limit_side_len: 736
- limit_type: min
- NormalizeImage:
- std: [0.229, 0.224, 0.225]
- mean: [0.485, 0.456, 0.406]
- scale: 1./255.
- order: hwc
- ToCHWImage:
- KeepKeys:
- keep_keys: ['image', 'shape']
-
- post_process:
- thresh: 0.3
- box_thresh: 0.5
- max_candidates: 1000
- unclip_ratio: 1.6
- use_dilation: true
-
-Cls:
- module_name: ch_ppocr_v2_cls
- class_name: TextClassifier
- model_path: models/ch_ppocr_mobile_v2.0_cls_infer.onnx
-
- use_cuda: true
- CUDAExecutionProvider:
- device_id: 0
- arena_extend_strategy: kNextPowerOfTwo
- cudnn_conv_algo_search: EXHAUSTIVE
- do_copy_in_default_stream: true
-
- cls_image_shape: [3, 48, 192]
- cls_batch_num: 6
- cls_thresh: 0.9
- label_list: ['0', '180']
-
-Rec:
- module_name: ch_ppocr_v3_rec
- class_name: TextRecognizer
- model_path: models/ch_PP-OCRv3_rec_infer.onnx
-
- use_cuda: true
- CUDAExecutionProvider:
- device_id: 0
- arena_extend_strategy: kNextPowerOfTwo
- cudnn_conv_algo_search: EXHAUSTIVE
- do_copy_in_default_stream: true
-
- rec_img_shape: [3, 48, 320]
- rec_batch_num: 6