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

在Android上推理时间如何优化? #43

Closed
luliang6 opened this issue Oct 24, 2019 · 5 comments
Closed

在Android上推理时间如何优化? #43

luliang6 opened this issue Oct 24, 2019 · 5 comments

Comments

@luliang6
Copy link

我使用ncnn的C++代码完成了在Android平台的编译,目前测试1000次取平均值,单次时间为42ms左右,测试手机是小米8(骁龙845),请问如何继续优化时间?

@Linzaer
Copy link
Owner

Linzaer commented Oct 24, 2019

多大的输入?多核吗?是只有cnn推理时间还是包括前置的图片处理和后处理?可以尝试ncnn 的int8量化、换slim版本的模型、根据落地场景选择降低输入分辨率(比如160x120、128x96)。

@luliang6
Copy link
Author

@Linzaer 输入为320×240,默认4核,只计算了cnn推理时间,无前后处理,落地场景是手机前置摄像头以640×480的分辨率输入做人脸识别。

@Linzaer
Copy link
Owner

Linzaer commented Oct 24, 2019

640x480输入算比较大了,推理计算量相当于320x240的4倍左右,这个时间应该差不多。如果你的场景距离要求在6m以内的话,320x240就应该够了。输入大小很影响推理速度的。

@luliang6
Copy link
Author

谢谢解答,我改小分辨率试试看。

@Linzaer
Copy link
Owner

Linzaer commented Oct 24, 2019

好的,不客气,也可以试下slim版本,会快一点。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants