我訓練完資料,生成三個檔案(data,index,meta),我使用腳本生成pb檔案,但是在使用的時候,一直報:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node conv3_1/weights/Assign was passed float from conv3_1/weights:0 incompatible with expected float_ref.
我的生成pb腳本如下:
def get_pb_file(meta_path):
with tf.Session() as sess:
# Restore the graph
saver = tf.train.import_meta_graph(meta_path)
# Load weights
saver.restore(sess, tf.train.latest_checkpoint('../checkpoint/'))
# Output nodes
output_node_names = [n.name for n in tf.get_default_graph().as_graph_def().node]
print(str(output_node_names))
for output_node in output_node_names:
print(output_node)
# Freeze the graph
frozen_graph_def = tf.graph_util.convert_variables_to_constants(
sess,
sess.graph_def,
output_node_names)
# Save the frozen graph
with open('output_graph-1.pb', 'wb') as f:
f.write(frozen_graph_def.SerializeToString())
請問這個是什么情況,有沒有大神遇到
uj5u.com熱心網友回復:
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/252278.html
