在PC上使用tflite 模型進(jìn)行推理,發(fā)現(xiàn)float模型跑起來(lái)很快,但是跑quant模型非常的慢,尤其是一些復(fù)雜模型,這是因?yàn)?intel x86_64沒(méi)有對(duì)量化推理計(jì)算進(jìn)行優(yōu)化,所以導(dǎo)致很慢。
解決方法就是使用是arm cpu的設(shè)備跑,又專門的優(yōu)化,會(huì)很快
INT TFLITE very much slower than FLOAT TFLITE
This is likely because quantized int requires an arm neon to be faster than float. On a PC (which is what I assume you are running on, float is likely better). This is because quantized int relies on special instructions that have not been emphasized on intel x86_64.
參考:https://github.com/tensorflow/tensorflow/issues/21698