"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

December 16, 2019

Day #307 - Porting Keras to Tensorflow Lite Version

Next Task is to run all the developed models in Pi using Tensorflow Lite. I am using google colab to convert the models into lite version.

#Step 1
from google.colab import drive
drive.mount('/content/drive')
#Upload data to drive in directory ColabData
#Step 2
import tensorflow as tf
print(tf.__version__)
#tensorflow.contrib is not there in 2.0
#!pip install tensorflow==2.0.0
#Downgrade tensorflow to 1.13.2
#!pip install tensorflow==1.13.2
#Step 3
from tensorflow.contrib import lite
converter = tf.lite.TFLiteConverter.from_keras_model_file(r'/content/drive/My Drive/ColabData/model_landmark_vgg16.h5')
tflite_model = converter.convert()
open(r'/content/drive/My Drive/ColabData/model.tflite','wb').write(tflite_model)
The ported models we will attempt to run in Rasberry PI as next steps

Happy Learning!!!

No comments: