Last active
September 30, 2024 01:32
-
-
Save sarkerrabi/b09a8f9a2fdc55355716f902964f8ef0 to your computer and use it in GitHub Desktop.
To convert an ML(Machine Learning) module like .h5 to tflite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
#store .h5 file in your .py folder | |
#load h5 module | |
model=tf.keras.models.load_model('sample_file.h5') | |
tflite_converter = tf.lite.TFLiteConverter.from_keras_model(model) | |
#convert | |
tflite_model = tflite_converter.convert() | |
open("tf_lite_model.tflite", "wb").write(tflite_model) | |
#done convertion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment