我正在移植 this TensorFlow JS tutorial到安卓。我必须转换 this JSON graph TensorFlow model到 .tflite,以便我可以在那里使用它。
我在谷歌上搜索了 TensorFlow 模型转换工具,但找不到任何东西。我还查看了 Android TensorFlow-lite 库是否有导入这些图形模型的方法,但我也没有找到任何东西。
我尝试使用我发现的以下 Python 脚本对其进行转换 here ,但它需要一个 .pb 文件:
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
最佳答案
TFLite 转换器目前不支持加载 tf-js 模型。但是,您可以尝试使用 tflite 自己的 posenet 模型 ( https://www.tensorflow.org/lite/models/pose_estimation/overview )
希望这能让事情变得更简单。
关于android - 如何将 TensorFlow JSON 图形模型转换为 .tflite?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57084795/