如何知道Tensorflow Lite模型的输入/输出功能信息?
我是移动开发人员.我想将各种Tensorflow Lite模型(.tflite
)与 MLKit 一起使用.
I'm mobile developer. And I want to use various Tensorflow Lite models(.tflite
) with MLKit.
但是有一些问题,我不知道如何知道.tflite
模型的输入/输出功能信息(这些是用于设置的参数).
But there are some issues, I have no idea of how to know .tflite
model's input/output feature info(these will be parameters for setup).
有什么办法知道吗?
对不起,英语不好,谢谢.
Sorry for bad English and thanks.
更新(18.06.13.):
Update(18.06.13.):
我找到了该网站 https://lutzroeder.github.io/Netron/.
这会根据您上传的模型(例如.mlmode
或.tflite
等)可视化图形,并找到输入/输出表单.
I found this site https://lutzroeder.github.io/Netron/.
This visualize graph based on your uploaded model(like .mlmode
or .tflite
etc.) and find input/output form.
这是示例屏幕截图! https://lutzroeder.github.io/Netron示例
Here is example screenshot! https://lutzroeder.github.io/Netron example
如果您已经拥有一个tflite模型,但您并没有自己生产
想要查看tflite文件内部并了解您的输入和输出,可以使用flatc
工具进行转换
模型到.json
文件并读取.
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.
首先克隆Flatbuffers存储库并构建Flatc.
First clone the flatbuffers repo and build flatc.
git clone https://github.com/google/flatbuffers.git
然后,您必须将tensorflow schema.fbs存储在本地.检出tensorflow github或下载
一个文件.
然后,您可以运行flatc
从输入的tflite模型生成json
文件.
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
这将创建一个易于阅读的input_model.json
文件.
This will create a input_model.json
file that can be easily read.