我想将 Keras 模型转换为 Tensorflow Lite 模型。当我检查文档时,据说我们可以使用 tf.keras HDF5 模型作为输入。这是否意味着我可以使用我保存的 HDF5 Keras 模型作为它的输入,或者 tf.keras HDF5 模型和 Keras HDF5 模型是不同的东西?
文档:https ://www.tensorflow.org/lite/convert
编辑:我可以使用这个 API 将我的 Keras 模型转换为 Tensorflow Lite 模型,但我还没有测试它。我的代码:
converter = tf.lite.TFLiteConverter.from_keras_model_file(path + 'plant-
recognition-model.h5')
tflite_model = converter.convert()
with open('plant-recognition-model.tflite', 'wb') as f:
f.write(tflite_model)