harvitronix / five-video-classification-methods

Code that accompanies my blog post outlining five video classification methods in Keras and TensorFlow
https://medium.com/@harvitronix/five-video-classification-methods-implemented-in-keras-and-tensorflow-99cad29cc0b5
MIT License
1.17k stars 479 forks source link

input node and output node name #83

Open styap94 opened 6 years ago

styap94 commented 6 years ago

im converting hdf5 to pb, and later want to use the model for android development, i want to know the input and output node name, where can i find it?

harvitronix commented 6 years ago

According to this: https://stackoverflow.com/questions/40028175/how-do-you-get-the-name-of-the-tensorflow-output-nodes-in-a-keras-model

You can output the node names like this: [print(n.name) for n in tf.get_default_graph().as_graph_def().node]

Though it's easier to simply give each layer a name, and then use the names you give it.

Edit: For instance, if you're using the lstm model, you could change model.add(Dense(self.nb_classes, activation='softmax')) to model.add(Dense(self.nb_classes, activation='softmax' name='output')) and then I believe you can simply use output as your output name.