Skip to content

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

fix(rapidocr): fixed typos of directml and npu

SWHLcec934a1140e
diff --git a/python/rapidocr/config.yaml b/python/rapidocr/config.yaml
index f385d27..ef88f27 100644
--- a/python/rapidocr/config.yaml
+++ b/python/rapidocr/config.yaml
@@ -38,7 +38,7 @@ EngineConfig:
cann_ep_cfg:
device_id: 0
arena_extend_strategy: "kNextPowerOfTwo"
- npu_mem_limit: 20 * 1024 * 1024 * 1024
+ npu_mem_limit: 21474836480 # 20 * 1024 * 1024 * 1024
op_select_impl_mode: "high_performance"
optypelist_for_implmode: "Gelu"
enable_cann_graph: true
@@ -57,12 +57,12 @@ EngineConfig:
gpu_id: 0
Det:
- engine_type: 'onnxruntime'
- lang_type: 'ch'
- model_type: 'mobile'
- ocr_version: 'PP-OCRv4'
+ engine_type: "onnxruntime"
+ lang_type: "ch"
+ model_type: "mobile"
+ ocr_version: "PP-OCRv4"
- task_type: 'det'
+ task_type: "det"
model_path: null
model_dir: null
@@ -80,12 +80,12 @@ Det:
score_mode: fast
Cls:
- engine_type: 'onnxruntime'
- lang_type: 'ch'
- model_type: 'mobile'
- ocr_version: 'PP-OCRv4'
+ engine_type: "onnxruntime"
+ lang_type: "ch"
+ model_type: "mobile"
+ ocr_version: "PP-OCRv4"
- task_type: 'cls'
+ task_type: "cls"
model_path: null
model_dir: null
@@ -93,15 +93,15 @@ Cls:
cls_image_shape: [3, 48, 192]
cls_batch_num: 6
cls_thresh: 0.9
- label_list: ['0', '180']
+ label_list: ["0", "180"]
Rec:
- engine_type: 'onnxruntime'
- lang_type: 'ch'
- model_type: 'mobile'
- ocr_version: 'PP-OCRv4'
+ engine_type: "onnxruntime"
+ lang_type: "ch"
+ model_type: "mobile"
+ ocr_version: "PP-OCRv4"
- task_type: 'rec'
+ task_type: "rec"
model_path: null
model_dir: null
diff --git a/python/rapidocr/inference_engine/onnxruntime/provider_config.py b/python/rapidocr/inference_engine/onnxruntime/provider_config.py
index f276239..23f4b5d 100644
--- a/python/rapidocr/inference_engine/onnxruntime/provider_config.py
+++ b/python/rapidocr/inference_engine/onnxruntime/provider_config.py
@@ -58,7 +58,7 @@ class ProviderConfig:
if self.cfg.dm_ep_cfg is not None:
return self.cfg.dm_ep_cfg
- if self.use_cuda:
+ if self.is_cuda_available():
return self.cuda_ep_cfg()
return self.cpu_ep_cfg()
@@ -136,7 +136,6 @@ class ProviderConfig:
f"{DML_EP} is not in available providers ({self.had_providers}). Use {self.default_provider} inference by default."
)
install_instructions = [
- f"{DML_EP} is not in available providers ({self.had_providers}). Use {self.default_provider} inference by default.",
"If you want to use DirectML acceleration, you must do:",
"First, uninstall all onnxruntime packages in current environment.",
"Second, install onnxruntime-directml by `pip install onnxruntime-directml`",