diff --git a/python/TFLiteBufferConverter.py b/python/TFLiteBufferConverter.py index cecc28b..7c9ce90 100644 --- a/python/TFLiteBufferConverter.py +++ b/python/TFLiteBufferConverter.py @@ -1,13 +1,16 @@ import tensorflow as tf -tf.logging.set_verbosity( tf.logging.ERROR ) +tf.compat.v1.logging.set_verbosity( tf.compat.v1.logging.ERROR ) keras_model_path = input( "Enter Keras model file path > " ) -converter = tf.lite.TFLiteConverter.from_keras_model_file( keras_model_path ) +keras_model = tf.keras.models.load_model(keras_model_path) +converter = tf.lite.TFLiteConverter.from_keras_model(keras_model) +#converter = tf.lite.TFLiteConverter.from_keras_model( keras_model_path ) + converter.post_training_quantize = True tflite_buffer = converter.convert() open( 'android/model.tflite' , 'wb' ).write( tflite_buffer ) -print( 'TFLite model created.') \ No newline at end of file +print( 'TFLite model created.')