tensorflow / tools下的freeze_graph.py output_node_names我应该设置什么?

时间:2017-09-29 03:27:34

标签: tensorflow graph model neural-network freeze

我只是在GitHub中的tensorflow / model中进行测试,我已经训练并获得了四个文件,而不是我冻结模型,问题即将到来。 我得到了支持 您需要将节点名称提供给--output_node_names

我的红色是graph.pbtxt,它太长了......

基本格式

node{
name: "ParseSingleExample/Squeeze_Shape_image/object/bbox/ymin/size"
op: "Const"
  device: "/device:CPU:0"
  attr {
    key: "_output_shapes"
    value {
      list {
        shape {
          dim {
            size: 1
          }
        }
      }
    }
  and so....

}

我该怎么办 谢谢

2 个答案:

答案 0 :(得分:1)

  

在定义图表时,您可以设置占位符/节点的名称,例如

# Initialize tensorflow placeholders
x = tf.placeholder('float', [None, self.time_steps, self.num_features], name='input_node')
y = tf.placeholder('float', [None, self.num_features], name='output_node')

y是您的标签的占位符。因此,output_node_name将为'output_node'

注意:如果没有name属性,则需要使用tf.identity方法。

答案 1 :(得分:0)

最简单的方法是使用tf.identity手动添加具有所需名称的标识节点。

相关问题