TensorFlow Lite quantization fails to improve inference latency

馋奶兔 提交于 2020-01-02 11:05:51

问题


TensorFlow website claims that Quantization provides up to 3x lower latency on mobile devices: https://www.tensorflow.org/lite/performance/post_training_quantization

I tried to verify this claim, and found that Quantized models are 45%-75% SLOWER than Float models in spite of being almost 4 times smaller in size. Needless to say, this is very disappointing and conflicts with Google's claims.

My test uses Google's official MnasNet model: https://storage.googleapis.com/mnasnet/checkpoints/mnasnet-a1.tar.gz

Here is the average latency based on 100 inference operations on a freshly rebooted phone:

  • Pixel 2: float=81ms, quant=118ms
  • Moto E: float=337ms, quant=590ms
  • LG Treasure: float=547ms, quant=917ms

My test app measures the timing for only one method (tfLite.runForMultipleInputsOutputs). The results are very consistent (within 1% across multiple executions).

I am hoping to see some comments from the Tensorflow team or anybody who can share their metrics. The numbers above are based on image classifier model. I also tested an SSD MobileNetV2 object detector with similar results (quantized model being substantially slower).

来源:https://stackoverflow.com/questions/55958129/tensorflow-lite-quantization-fails-to-improve-inference-latency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!