16 lines
469 B
Python
16 lines
469 B
Python
import tensorflow as tf
|
|
|
|
|
|
def convert_tensorflow_lite(model_path, save_path='../mobilenet_nnconv5.tflite'):
|
|
# Convert the model
|
|
converter = tf.lite.TFLiteConverter.from_saved_model(model_path) # path to the SavedModel directory
|
|
tflite_model = converter.convert()
|
|
|
|
# Save the model.
|
|
with open('model.tflite', 'wb') as f:
|
|
f.write(tflite_model)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
convert_tensorflow_lite('../mobilenet-nnconv5-e12-experimental')
|