How to find output node names for frozen graph

315 views Asked by At

I'm following a Google Colab guide from Roboflow to train the MobileNetSSD Object detection model from Tensorflow on a custom dataset. Here is the link to the colab guide: https://colab.research.google.com/drive/1wTMIrJhYsQdq_u7ROOkf0Lu_fsX5Mu8a

The data set is the example set from the Roboflow website called "Chess sample" which everyone who registers an account on the website gets in their workspace folder. Here is the link to get that setup: https://blog.roboflow.com/getting-started-with-roboflow/

The Colab guide returns a frozen graph and i want to convert it to a tfjs_graph_model using this code:

tensorflowjs_converter \
    --input_format=tf_saved_model \
    --output_node_names='MobilenetV1/Predictions/Reshape_1' \
    --saved_model_tags=serve \
    /mobilenet/saved_model \
    /mobilenet/web_model

when running this in Colab i get following error:

KeyError: "The name 'MobilenetV1/Predictions/Reshape_1' refers to an Operation not in the graph."

I think the problem is that "MobilenetV1/Predictions/Reshape_1" is not an output node. Probably the right output node names can be found in the Colab guide.

1

There are 1 answers

0
Joshua  Morales On

I was just experiencing the same thing, and I could not find other ways to see the output node names of a frozen model, but thank God because I discovered the website www.netron.app

I uploaded my frozen inference graph (.pb) and netron.app produced a gui tree of nodes. I clicked the second to the last bottom node, and it shows the properties of that node, and at the bottom there was the Outputs section with a value showing the operation names that I used for the --output_node_names. I replaced the --output_node_names='MobilenetV1/Predictions/Reshape_1' with --output_node_names=Postprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack/TensorArrayGatherV3

I am just telling you how I solved this with my trained frozen model. The output node names will probably not be the same as yours.