You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Simple example for getting input and output nodes of TF graph #1040
#862 enabled extracting information about nodes in a TF model. However, it's not completely clear how to extract the most important information for using the model with the TF Transform: what are the input and output nodes?
The DnnAnalyzer shows how to view all the nodes, but this can be improved to identify which are the input and output nodes (based on the other links) to make this easier.
Proposal: either modify DnnAnalyzer to identify the input and output nodes, or provide a separate sample that does this.
Can we approach this from scenario-first perspective? What do we want to have? A commandline tool to inspect TF models? A programmatic way to do this? Or something else?
What is the anticipated usage pattern?
Also, I think, 'output' nodes in TF is not an actual TF term. What do you call an 'output' node?
Great questions. The scenario is that I want to build an ML.NET model that takes advantage of a pretrained TensorFlow model I found on the web. Suppose I am doing image classification and want to use the Inception model that I found here. For a simple scenario, I just want to give my image as input and get the scores the model provides. For a more advanced scenario, I want to get the penultimate layer output so I can use it as a featurizer.
To use the model in ML.NET, I need to know:
What is the input node? What format of data does it expect?
What is the name of the output node with the scores across the 1000 classes?
For the advanced scenario: what is the penultimate layer node?
I could perhaps get this information through a tool such as Netron, but the APIs this issue refers to could make this easier for me.
Once I have this information, I can plug this into my ML.NET pipeline and start using the Inception model.
I don't have a strong opinion about whether this should be programmatic or through a CLI. A CLI feels more natural as I want this information when I'm developing my training app and don't want to open up a separate app to get this info (I don't need it as part of my training app).
Some TF graphs are more complicated so identifying the input and output might not be straightforward. A simple heuristic could be that input nodes are ones that don't have any other node providing data to them. Output nodes are ones that aren't used as input to any other node.
However, its not possible to get the output nodes as they are not marked specifically. So, user will have to inspect the complete model to see the outputs.
Activity
Zruty0 commentedon Oct 7, 2018
Can we approach this from scenario-first perspective? What do we want to have? A commandline tool to inspect TF models? A programmatic way to do this? Or something else?
What is the anticipated usage pattern?
Also, I think, 'output' nodes in TF is not an actual TF term. What do you call an 'output' node?
GalOshri commentedon Oct 7, 2018
Great questions. The scenario is that I want to build an ML.NET model that takes advantage of a pretrained TensorFlow model I found on the web. Suppose I am doing image classification and want to use the Inception model that I found here. For a simple scenario, I just want to give my image as input and get the scores the model provides. For a more advanced scenario, I want to get the penultimate layer output so I can use it as a featurizer.
To use the model in ML.NET, I need to know:
I could perhaps get this information through a tool such as Netron, but the APIs this issue refers to could make this easier for me.
Once I have this information, I can plug this into my ML.NET pipeline and start using the Inception model.
I don't have a strong opinion about whether this should be programmatic or through a CLI. A CLI feels more natural as I want this information when I'm developing my training app and don't want to open up a separate app to get this info (I don't need it as part of my training app).
Some TF graphs are more complicated so identifying the input and output might not be straightforward. A simple heuristic could be that input nodes are ones that don't have any other node providing data to them. Output nodes are ones that aren't used as input to any other node.
Thoughts?
zeahmed commentedon May 22, 2019
There is already a programmatic way get all the input nodes ('Placeholder') from the graph.
machinelearning/src/Microsoft.ML.TensorFlow/TensorFlowModel.cs
Line 47 in 2ee4d31
However, its not possible to get the output nodes as they are not marked specifically. So, user will have to inspect the complete model to see the outputs.
zeahmed commentedon May 22, 2019
I am closing it. Reopen it if necessary.