Not able to determine endpoints/tensors in the model
Please let us know which model this issue is about (specify the top-level directory)
https://github.com/tensorflow/models/blob/master/inception/inception/slim/inception_model.py
As per documentation appearing elswhere, the Inception V3 final tensor is softmax:0 and the one before that is pool_3:0
However none of these appear in the definition at the link indicated above
Have a look here https://github.com/tensorflow/models/blob/master/slim/nets/inception_v3.py
I think Softmax:0 (capitalization) is the difference. I think the elsewhere documentation you are refering to would be this? https://github.com/tensorflow/tensorflow/blob/master/tensorflow/models/image/imagenet/classify_image.py#L147-L154
edit: Can't figure out what to change DecodeJpeg/contents:0 to for a tf-slim finetuned inceptionv3 model
Yes, the "elsewhere" documentation is correct. It lists the last tensor as softmax:0 and the one before that as pool_3:0. This works well.
However the challenge is access the previous tensors generated as documentation is poor about the pre-trained model provided with tensorflow.
In the link you provided https://github.com/tensorflow/models/blob/master/slim/nets/inception_v3.py
I could neither find softmax:0 or pool_3:0.
try something like this:
with tf.Graph().as_default():
... (set up your graph etc)...
with tf.Session() as sess:
for op in sess.graph.get_operations():
print(op.name)
it should print out all the names
I did, it's not helpful as the dependencies and flow of tensors is not clear.
I posted the question after having exhausted most of the links that google throws up on the topic.
My conclusion is that the best approach would be to document the pre-trained model the same way that the classify_image.py clearly documents the last and the send last tensors.
I believe the model in https://github.com/tensorflow/tensorflow/blob/master/tensorflow/models/image/imagenet/classify_image.py is different from the one being referenced here (https://github.com/tensorflow/models/blob/master/inception), so I would be weary of assuming the documentation of one applies to the other.
The model construction functions return the output nodes and their names are available. For example, the function to construct the model in inception_model.py returns the logits node, whose name is in its name property.
I tried the following:
logits, aux = inception.inference(images, num_classes)
print logits.name
and got tower_0/logits/logits/xw_plus_b:0.
Thus, in general, the name of the output node is available from the function that constructs the model.
Hopefully this answers your query. Closing this issue, let me know if we misunderstood your concerns.
@asimshankar I tried to print the logits names and got a similar one as tower_0/logits/logits/xw_plus_b:0 But to freeze my fine tuned inceptionv3 model on my custom dataset according to https://blog.metaflow.fr/tensorflow-how-to-freeze-a-model-and-serve-it-with-a-python-api-d4f3596b3adc I am getting error such as AssertionError: tower_0/logits/logits/xw_plus_b:0 is not in graph Can you help me with this issue?