RapidAI / RapidOCR

📄 Awesome OCR multiple programing languages toolkits based on ONNXRuntime, OpenVINO and PaddlePaddle.
https://rapidai.github.io/RapidOCRDocs
Apache License 2.0
3.13k stars 370 forks source link

rapidocr_paddle的cpu_math_library_num_threads设置有误 #214

Closed SWHL closed 1 week ago

SWHL commented 3 months ago

你好,我实际测试下来,发现CPU上rapidocr_onnxruntime性能比rapidocr_paddle好,但是这个差异主要是默认的cpu_math_library_num_threads没有设置导致的。具体原因是:以下这个分支里的设置线程数没有跑进去,导致paddle CPU推理的默认性能很差。

cpu_nums = os.cpu_count()
infer_num_threads = config.get("cpu_math_library_num_threads", -1)
if infer_num_threads != -1 and 1 <= infer_num_threads <= cpu_nums:
     infer_opts.set_cpu_math_library_num_threads(infer_num_threads)

希望把默认的infer_num_threads这块改一下。

Originally posted by @vivienfanghuagood in https://github.com/RapidAI/RapidOCR/discussions/196#discussioncomment-10405131

SWHL commented 2 months ago

该问题查看源码,当前逻辑是:如果不显式指定infer_num_threads,则不通过inference.set_cpu_math_library_num_threads来设置,采用Config初始化的默认值。@vivienfanghuagood

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 1 week ago

This issue was closed because it has been stalled for 5 days with no activity.