keras_to_tensorflow icon indicating copy to clipboard operation
keras_to_tensorflow copied to clipboard

input node and output node

Open styap94 opened this issue 6 years ago • 4 comments

hi, im coverting hdf5 to pb, so that i can use the model in android. but how do i know the input node name and output node name?

styap94 avatar Apr 05 '18 09:04 styap94

Use -graph_def True to store the text format of the graph. $ python keras_to_tensorflow.py -graph_def True -input_model_file ...

You will see the input & output layer name (along with many other info.) from the ascii file generated in the output directory.

sumsuddin avatar Apr 10 '18 07:04 sumsuddin

@hanako94 Other than what @sumsuddin suggested, you can always explicitly name your layers in keras. I suggest you to name the input and output layers (and any other layer which you might care for).

amir-abdi avatar Apr 23 '18 19:04 amir-abdi

thanks you so much. i managed to find it by using this method https://developer.arm.com/technologies/machine-learning-on-arm/developer-material/how-to-guides/optimizing-neural-networks-for-mobile-and-embedded-devices-with-tensorflow/determine-the-names-of-input-and-output-nodes

styap94 avatar Apr 24 '18 08:04 styap94

It is possible to use the method to output all names: https://tensorflow.github.io/rust/tensorflow/struct.Graph.html#method.operation_iter

graph.operation_iter().for_each(|x| println!("{}", x.name));

After it, it is easy to detect input and output of the model. Usually dense_1_input and output_node0

inv2004 avatar May 29 '18 15:05 inv2004