【发布时间】:2019-06-26 23:40:06
【问题描述】:
附言。请不要将我指向converting Keras model directly to tflite,因为我的 .h5 文件无法直接转换为 .tflite。我以某种方式设法将我的 .h5 文件转换为 .pb
我已关注this Jupyter notebook 使用 Keras 进行人脸识别。然后我将模型保存到model.h5 文件中,然后使用this 将其转换为冻结图model.pb。
现在我想在 Android 中使用我的 tensorflow 文件。为此,我需要使用 Tensorflow Lite,这需要我将模型转换为 .tflite 格式。
为此,我正在尝试遵循官方指南here。如您所见,它需要input_array 和output_array 数组。如何从我的model.pb 文件中获取这些内容的详细信息?
【问题讨论】:
-
只需从图中获取输入和输出张量即可。将它们放入数组中。
-
Shubham 的回答是正确的。但请注意,如果您使用 TFLiteConverter 的 python 接口导出到 SavedModel 或直接从 Keras 模型导出,则不必指定输入和输出,因为它们已经包含在表示中。
标签: python tensorflow tensorflow-lite