tucan9389 / tf2-mobile-image-classification

Apache License 2.0
0 stars 0 forks source link

Implement TFLite converter #7

Open tucan9389 opened 4 years ago

tucan9389 commented 4 years ago

TF 2.0

Saved the model using tf.saved_model.save and then convert the saved model to a tf lite compatible format.

saved_model_dir = 'save/fine_tuning'
tf.saved_model.save(model, saved_model_dir)

converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
tflite_model = converter.convert()

with open('model.tflite', 'wb') as f:
  f.write(tflite_model)

Download the converted model and labels

files.download('model.tflite')
files.download('labels.txt')