TensorFlow integrates a function to transform a SavedModel model to the TF Lite format. To do so, we first create a TensorFlow Lite converter object:
# From a Keras model
converter = tf.lite.TFLiteConverter.from_keras_model(model)
## Or from a SavedModel
converter = tf.lite.TFLiteConverter('./saved_model')
Then, the model is saved to disk:
tflite_model = converter.convert()
open("result.tflite", "wb").write(tflite_model)
You will notice that the TensorFlow Lite function offers fewer options than the Apple Core ML equivalent. Indeed, TensorFlow Lite does not handle preprocessing and resizing of the images automatically. This has to be handled by the developer in the Android app.