How to Convert Keras model into Tensorflow lite

0xkoji - Jun 14 '19 - - Dev Community

I just found a great video for converting Keras model into Tensorflow lite model.

https://www.youtube.com/watch?v=IJt_veyTlv8

requirements

I asked about the version of Tensorflow to android daily life with ameer. He told me he was using tensorflow1.12.
So need to install that version

!pip uninstall tensorflow
!pip install tensorflow==1.12
Enter fullscreen mode Exit fullscreen mode

code

from tensorflow.contrib import lite
converter = lite.TFLiteConverter.from_keras_model_file('/content/VGG_cross_validated.h5')
tfmodel = converter.convert()
open("model.tflite","wb").write(tfmodel)
Enter fullscreen mode Exit fullscreen mode

I will try Tensorflow lite model with Edge-TPU.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .