opencv - Which is faster when deploying cnn models by TensorFlow Lite, Caffe2 or OpenCV?
问题描述
We can deploy MobileNet on Smartphone by TensorFlow Lite, Caffe2 or OpenCV, and I think Caffe2 will provide the best performance with higher fps. But why? Is the performance gap between them so large? Thanks.
解决方案
您可能应该选择 TensorFlow Lite。最后我看了一下,Caffe2 对智能手机 GPU 的支持几乎为零,而 TFLite 现在支持 iOS 和许多 Android 设备(所有具有 OpenGLES >=3.1 的设备)。使用 GPU 通常会使事情快几倍,并且您可以使用 TFLite 将推理精度降低到半浮点 (FP16) 以获得更高的速度并且不会对性能造成太大影响。
当您无法使用移动 GPU 时,您可能希望将您的网络量化为 int8,这在 TensorFlow 和 TensorFlow Lite 中很容易实现,无论是在训练期间还是训练之后。Caffe2 似乎需要 QNNPACK 进行量化,据称速度快 2 倍。问题是它仅适用于他们发布的两个预训练模型(https://github.com/pytorch/QNNPACK/issues/12),因此您无法转换自己的模型。
所以我真的想不出在 TFLite 上使用 Caffe2 的理由。
我不确定 OpenCV 的 DNN 模块,但我严重怀疑它是否支持移动 GPU。量子化的可能性很小。
推荐阅读
- java - 无法在 intellij 中导入 JavaFx
- python - 并发和 Selenium - 多处理与多线程
- docker - 无法启动 docker 守护进程(graphdriver 问题)
- python - MinMaxScaling 没有返回正确的值
- objective-c - 我有一个带有自定义 UIStoryboardSegue 对象的小型测试项目,但动画有黑色阴影。有什么办法可以去掉?
- angular6 - 是否可以将 angular-6 生成的库导入 angular 5?
- ruby-on-rails - ApplicationRecord:访问范围内的模型父级
- docker - Docker 和 VS Mac
- python-3.x - KMeans 查找图像数组中每个图像的主色
- azure-data-lake - 在 ADLA 中组合两个行集而不使用 join on 子句