如何知道 Tensorflow Lite 模型的 input/output 特征信息?
How to know Tensorflow Lite model's input/output feature info?
我是移动开发人员。我想将各种 Tensorflow Lite 模型 (.tflite
) 与 MLKit 一起使用。
但是有一些问题,我不知道如何知道.tflite
模型的input/output特征信息(这些将是设置的参数)。
有什么方法可以知道吗?
抱歉英语不好,谢谢。
更新(18.06.13.):
我找到了这个网站 https://lutzroeder.github.io/Netron/。
此可视化图表基于您上传的模型(如 .mlmode
或 .tflite
等)并找到 input/output 形式。
这是示例截图!
https://lutzroeder.github.io/Netron example
如果您已经有一个不是您自己生产的tflite模型,并且您
想要查看 tflite 文件内部并了解您的输入和输出,您可以使用 flatc
工具并转换
模型到 .json
文件并阅读。
首先克隆 flatbuffers 存储库并构建 flatc。
git clone https://github.com/google/flatbuffers.git
然后您必须将 tensorflow schema.fbs 存储在本地。检查 tensorflow github 或下载
one file。
然后你可以 运行 flatc
从输入的 tflite 模型生成 json
文件。
flatc -t schema.fbs -- input_model.tflite
这将创建一个易于阅读的 input_model.json
文件。
添加到上面的答案:
请参阅这些构建说明:
https://google.github.io/flatbuffers/md__building.html
If you already have a tflite model that you did not produce yourself,
and you want to look inside the tflite file and understand your inputs
and outputs, you can use flatc tool and convert the model to .json
file and read that.
First clone the flatbuffers repo and build flatc.
git clone https://github.com/google/flatbuffers.git
Then you have to have the tensorflow schema.fbs stored locally. Either checkout the
tensorflow github or download that one file. Then you can run flatc to
generate the json file from then input tflite model.
flatc -t schema.fbs -- input_model.tflite
This will create a input_model.json file that can be easily read.
我是移动开发人员。我想将各种 Tensorflow Lite 模型 (.tflite
) 与 MLKit 一起使用。
但是有一些问题,我不知道如何知道.tflite
模型的input/output特征信息(这些将是设置的参数)。
有什么方法可以知道吗?
抱歉英语不好,谢谢。
更新(18.06.13.):
我找到了这个网站 https://lutzroeder.github.io/Netron/。
此可视化图表基于您上传的模型(如 .mlmode
或 .tflite
等)并找到 input/output 形式。
这是示例截图! https://lutzroeder.github.io/Netron example
如果您已经有一个不是您自己生产的tflite模型,并且您
想要查看 tflite 文件内部并了解您的输入和输出,您可以使用 flatc
工具并转换
模型到 .json
文件并阅读。
首先克隆 flatbuffers 存储库并构建 flatc。
git clone https://github.com/google/flatbuffers.git
然后您必须将 tensorflow schema.fbs 存储在本地。检查 tensorflow github 或下载
one file。
然后你可以 运行 flatc
从输入的 tflite 模型生成 json
文件。
flatc -t schema.fbs -- input_model.tflite
这将创建一个易于阅读的 input_model.json
文件。
添加到上面的答案:
请参阅这些构建说明:
https://google.github.io/flatbuffers/md__building.html
If you already have a tflite model that you did not produce yourself, and you want to look inside the tflite file and understand your inputs and outputs, you can use flatc tool and convert the model to .json file and read that.
First clone the flatbuffers repo and build flatc.
git clone https://github.com/google/flatbuffers.git
Then you have to have the tensorflow schema.fbs stored locally. Either checkout the tensorflow github or download that one file. Then you can run flatc to generate the json file from then input tflite model.
flatc -t schema.fbs -- input_model.tflite
This will create a input_model.json file that can be easily read.