import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
tflite_model = converter.convert()
with open('xray_model_quantized.tflite', 'wb') as f:
f.write(tflite_model)
print("Model successfully converted and quantized to TensorFlow Lite!")
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
tflite_model = converter.convert()
with open('xray_model_quantized.tflite', 'wb') as f:
f.write(tflite_model)
print("Model successfully converted and quantized to TensorFlow Lite!")