Created
November 9, 2021 09:27
-
-
Save hayunjong83/8637cdde4366c9908f394e39c5ce7d06 to your computer and use it in GitHub Desktop.
udacity TensorFlow Lite Chap.2-3 example code
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 | |
import pathlib | |
# Load the MobileNet tf.keras model | |
model = tf.keras.applications.MobileNetV2(weights="imagenet", input_shape=(224,224,3)) | |
# Convert the model | |
converter = tf.lite.TFLiteConverter.from_keras_model(model) | |
tflite_model = converter.convert() | |
# Save the model | |
tflite_model_file = pathlib.Path('/tmp/foo.tflite') | |
tflite_model_file.write_bytes(tflite_model) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment