android - 如何将 TensorFlow JSON 图形模型转换为 .tflite?

标签 android json tensorflow model tensorflow-lite

我正在移植 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/

相关文章:

python - 使用 tf.data 与两个数据集的叉积进行增强

java - SQLite 高分,CursorIndexOutOfBounds - Android

java - 当我尝试获取 Int 时我的应用程序停止

java - Retrofit 2 的自定义 CallAdapter 和 Android 上的线程问题

java - 如何在单独的 View 中获取 TextView 的 OnClick 事件?

java - 如何通过读取 JSON 来修复 UnrecognizedPropertyException?

json - 如何使用 jq 从 JSON 字符串中获取键值对

tensorflow - 限制 skflow 中的 GPU 内存分配

json - jq 根据属性的现有值修改值

tensorflow - tf.gradients 会通过 tf.cond 吗?