-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
yolov8.cpp模型预测速度相比以往差了10倍不止 #5666
Comments
第一个问题留给其他大佬,我只能回答第二个问题,
如果您确实有其他图像尺寸的识别需求的话,可能尝试下先用ultralytics官方的model.export()导出torchscript,然后再使用nihui实现的pnnx工具(https://github.com/pnnx/pnnx )将其转换成 dynamic input shape 的ncnn模型。 |
okok,感谢大佬,测试过了ultralytics官方的model.export()加个参数设置imgsz为320那320尺寸的就能用了 |
第一个问题是因为官方版的把模型后处理给塞进模型里面了,他们图方便就把所有的框都解码出来了。原来那些速度快的版本在解码每个框之前会读取和计算这个框的得分,分数太低就不会去进一步解码。然后因为解码操作里面有矩阵乘法、softmax之类很慢的操作,所以用官方版的反而速度会很慢,虽然开发起来很方便=。= |
经过同一个pt模型测试,
使用yolov8自带的ncnn一键导出了模型,用example的yolov8.cpp去推理速度300-500毫秒之间
网络上那些需要修改head和block所导出的模型再去用旧代码推理发现只要15-30毫秒...
还有个问题是推理的时候如果target_size如果由640改为320就会导致检测结果多至4000多...以前旧版的改了就没问题反而速度会变快
Tasks
Tasks
The text was updated successfully, but these errors were encountered: