DEV Community

0xkoji
0xkoji

Posted on

How to Convert Keras model into Tensorflow lite

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.

Top comments (1)

Collapse
 
abhishekgautam101 profile image
Abhishek Gautam

Thanks a lot! I have been searching for this for days.