How can I test a .tflite model to prove that it behaves as the original model using the same Test Data?

心不动则不痛 提交于 2019-11-29 05:48:41

You may use TensorFlow Lite Python interpreter to test your tflite model.

It allows you to feed input data in python shell and read the output directly like you are just using a normal tensorflow model.

I have answered this question here.

And you can read this TensorFlow lite official guide for detailed information.

I also found a very good visualization tool which can load .tflite file directly to let you inspect your model architecture and model weights.

There is a tflite_diff_example_test in the TensorFlow code base. It generates random data and feed the same data into TensorFlow & TensorFlow lite, then compare if the difference is within a small threshold.

You can to checkout TensorFlow code from Github, and run it with bazel:

bazel run //tensorflow/contrib/lite/testing:tflite_diff_example_test

then you'll see what arguments you need to pass.

In addition to the answer given by @miaout17, to debug / understand your tflite model (which is the spirit of the question), you can

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