Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rapidocr_paddle的cpu_math_library_num_threads设置有误 #214

Open
SWHL opened this issue Aug 21, 2024 · 2 comments
Open

rapidocr_paddle的cpu_math_library_num_threads设置有误 #214

SWHL opened this issue Aug 21, 2024 · 2 comments
Labels

Comments

@SWHL
Copy link
Member

SWHL commented Aug 21, 2024

你好,我实际测试下来,发现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 #196 (comment)

@SWHL SWHL changed the title rapid_ocrpaddle的cpu_math_library_num_threads设置有误 rapidocr_rpaddle的cpu_math_library_num_threads设置有误 Sep 19, 2024
@SWHL SWHL changed the title rapidocr_rpaddle的cpu_math_library_num_threads设置有误 rapidocr_paddle的cpu_math_library_num_threads设置有误 Sep 19, 2024
@SWHL
Copy link
Member Author

SWHL commented Sep 19, 2024

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

Copy link

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 github-actions bot added the Stale label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant