Closed D-X-Y closed 8 years ago
@D-X-Y : This is perhaps better asked on stackoverflow. The github issue list aims to be focused on bugs and feature requests.
That said, you can visualize the graph in TensorBoard after dumping it out as so:
with open('/tmp/graph.pbtxt', 'w') as f:
f.write(str(sess.graph.as_graph_def())
and explore the layers, even find the next-to-last.
Hope that helps.
@D-X-Y could you share the stackoverflow link for this question? I am interested to do the exact task with slim as well.
@ogail Hi, you could have a loot at https://github.com/tensorflow/models/issues/429#issuecomment-277885861 I have tested the code and get the correct output.
@ogail Hi,were you able to figure out the feature extraction ?. I am trying to do the same task with VGG 16 in slim but have used Batch Normalization and not really sure how should I get the feature vector before and after batch normalization. Any code snippet will be appreciated.
@D-X-Y Any code or help with my question above
@D-X-Y Hi there, were you able to extract the next-to-last feature vector from this CNN? If so, I'd love some help. I cannot seem to find this answer on stackoverflow
@alexandercameronh I follow the code in https://github.com/tensorflow/models/issues/429#issuecomment-277885861 . As tensorflow changes so fast and I have moved my projects to PyTorch, I am not sure whether this code is ok for the current version of tensorflow.
@ogail @D-X-Y Hi there, I'm trying to extract features from custom trained inception resnet v2, for a further step of indexing the images.Were you able to extract the next to last feature from the inception resnet v2? can you provide some help with how to extract features and how to get the correct tensor name? Thanks
@skhater @D-X-Y This is the one I used to extract the last FC layer before softmax.
prelogits = sess.graph.get_tensor_by_name(
'InceptionResnetV2/Logits/Flatten/flatten/Reshape:0'
)
Here is the step by step on how I find and use this layer:
https://gyang274.github.io/tensorflow-serving-tutorial/0xffb00.misc.tensorflow.html
https://gyang274.github.io/tensorflow-serving-tutorial/0x02b01.slim.inception.resnet.v2.html
Thank you.
Problem Description
I want to use the pre-trained Inception-ResNet-v2 model to extract features from the next-to-last layer of the CNN (seems the 'PreLogitsFlatten' tensor).
Once classify a single image(one original JPEG image), and extract features.
Addition
I use
to extract feature from an old version of Inception-v3 code.
Could anyone give an example how to do it with slim model? Thanks