-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Simple example for getting input and output nodes of TF graph #1040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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:
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? |
There is already a programmatic way get all the input nodes ('Placeholder') from the graph.
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. |
I am closing it. Reopen it if necessary. |
#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.The text was updated successfully, but these errors were encountered: