Home > other >  Tensorflow training is completed, how to pb and tflite file, please guide
Tensorflow training is completed, how to pb and tflite file, please guide

Time:01-26

I finished training data, the three files (data, index, meta), I use scripts generate pb files, but at the time of use, have been reported:

 tensorflow. Python. Framework. Errors_impl. InvalidArgumentError: Input 0 of the node conv3_1/weights/Assign the was passed float from conv3_1/weights: 0 incompatible with expected float_ref. 



I generate pb script is as follows:

 def get_pb_file (meta_path) : 
With tf. The Session () as sess:
# Restore the graph
Saver=tf. Train. Import_meta_graph (meta_path)

# the Load weights
Saver. Restore (sess, tf. Train. Latest_checkpoint ('.. Checkpoint/'))

# the Output nodes
Output_node_names=[n.n ame for n in tf. Get_default_graph () as_graph_def () node]
Print (STR (output_node_names))
For output_node output_node_names in:
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 the open (' output_graph - 1. Pb, 'wb) as f:
F.w rite (frozen_graph_def SerializeToString ())


Could you tell me what the situation, have encountered great god

CodePudding user response:

  • Related