Many of the transforms that the tool supports need to know what the input and output layers of the model are. The best source for these is the model training process, where for a classifier the inputs will be the nodes that receive the data from the training set, and the output will be the predictions. If you're unsure, the summarize_graph tool can inspect the model and provide guesses about likely input and output nodes, as well as other information that's useful for debugging.
可以使用Keras model.summary()获取最后一层的名称。
如果model.outputs不为空,则可以通过以下方式获取节点名称:
你可以通过
然后通过
之后,您可以通过
如果在Keras中构造模型时未显式指定输出节点,则可以按如下方式打印它们:
[print(n.name) for n in tf.get_default_graph().as_graph_def().node]
然后你需要做的就是找到正确的一个,它通常类似于激活函数的名称。您可以使用这个字符串名作为
freeze_graph
函数中output_node_names
的值。您还可以使用tensorflow实用程序:
summarize_graph
查找可能的output_nodes
。从official documentation:它只需要保存的图形
pb
文件作为输入。查看文档中的示例。相关问题 更多 >
编程相关推荐