以mobilenet v2
为例子,我已经训练好了模型,有tflite
格式和onnx
格式两种模型的权重文件,我想获取tflite
模型在推理阶段neck
部分的输出。
- 查看
onnx
模型得到neck
最后一层位置
使用netron查看onnx
模型结构
从name中能知道Reshape
是neck
的最后一层
- 得到
neck
最后一层的output
在tflite
模型中的编号
使用netron查看tflite
模型结构找到Reshape
的输出的编号

- 在推理脚本中增加保存中间层输出

其他说明:
偶尔同样的操作就会报错ValueError: Tensor data is null. Run allocate_tensors() first
,原因有说是tf的版本的原因,但我不更改版本的情况下有时也出现这个问题,以后再细究吧,保存下当前的tf版本:
