问题描述
限时送ChatGPT账号..我正在使用 MobileNetv2
,并使用 deeplab
作为预处理器(如果这是正确的术语?).我已经完成了迁移学习以在我自己的数据集上训练示例网络,创建了 .meta
、.index
和 .pbtxt
文件.当我尝试将这些转换为 pb
文件时,我遇到了许多问题.
I am working with MobileNetv2
, and using deeplab
as the preprocessor (if that's the right term?). I have done transfer learning to train the example network on my own dataset, creating .meta
, .index
and .pbtxt
files. When I try to convert these to a pb
file, I have hit a number of problems.
freeze_graph.py
需要知道 output_node_names
.如果我使用 InceptionV3 而不是 deeplab,那就是InceptionV3/Predictions/Reshape_1".在其他地方,我看到人们使用softmax".
freeze_graph.py
needs to know the output_node_names
. If I were using InceptionV3 instead of deeplab, that would be "InceptionV3/Predictions/Reshape_1". Elsewhere I have seen people use "softmax".
我尝试用
I have tried listing the node names with
print([node.name for node in graph.as_graph_def().node])
print([node.name for node in graph.as_graph_def().node])
但是那个列表太长了.搜索预测"、输出"、重塑"、softmax"的变体并没有发现任何有希望的东西.
but that list is way too long. Searching for variations of "prediction", "output", "reshape", "softmax" didn't reveal anything promising.
我查看了张量板,但我对图表的复杂性感到不知所措.我找不到任何看起来像输出节点的东西.
I had a look on the tensorboard, but I was overwhelmed by the complexity of the diagram. I couldn't find anything which looked like an output node.
有些人建议使用 bazel,但当我尝试时
Some people suggest bazel, but when I tried
bazel 构建 tensorflow/tools/graph_transforms:summarize_graph
bazel build tensorflow/tools/graph_transforms:summarize_graph
我明白
ERROR: no such package 'tensorflow/tools/graph_transforms': BUILD file not found on package path`
如果相关,我使用 mobilenetv2_coco_voc_trainaug
检查点作为从 https://github/tensorflow/models/blob/master/research/deeplab/g3doc/model_zoo.md
in case it is relevant, I used the mobilenetv2_coco_voc_trainaug
checkpoint as the starting point for my transfer learning from https://github/tensorflow/models/blob/master/research/deeplab/g3doc/model_zoo.md
推荐答案
鉴于生成图的代码是 在github上,我只是从头开始构建它并检查最终名称.
Given that the code to generate the graph is on github, I'd just construct it from scratch and check the final name.
import tensorflow as tf
# you'll need `models/research/slim` on your PYTHONPATH FOR THE FOLLOWING
from nets.mobilenet import mobilenet_v2
image = tf.zeros((1, 224, 224, 3), dtype=tf.float32) # values don't matter
out, endpoints = mobilenet_v2.mobilenet(image)
print(out.name)
这篇关于如何找到特定 tensorflow 网络的 output_node_names?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论