Skip to content
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

converting to ONNX, need names of input and output nodes. #287

Open
I-CANT-CODE opened this issue Nov 15, 2019 · 1 comment
Open

converting to ONNX, need names of input and output nodes. #287

I-CANT-CODE opened this issue Nov 15, 2019 · 1 comment

Comments

@I-CANT-CODE
Copy link

Hi I am trying to convert the model to onnx for deployment. To do that I need the name of the input and output

from tf2onnx repo:
"Tensorflow model's input/output names, which can be found with summarize graph tool. Those names typically end on :0, for example --inputs input0:0,input1:0. inputs and outputs are not needed for models in saved-model format."

I basically edited the saving mechanism of the repo to save the model into .pb because thats what tf summarizer graph tool requires. here is this is the output of the tf summarize graph module, but I am not sure which nodes are the input and output nodes. If anyone can help with this I'd greatly appreciate it.

bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=/home/users/user/tf_unet/tmp/tmp/my_model.pb
Found 3 possible inputs: (name=x, type=float(1), shape=[?,?,?,1]) (name=y, type=float(1), shape=[?,?,?,2]) (name=dropout_probability, type=float(1), shape=)
Found 26 variables: (name=down_conv_0/w1, type=float(1), shape=[3,3,1,32]) (name=down_conv_0/w2, type=float(1), shape=[3,3,32,32]) (name=down_conv_0/b1, type=float(1), shape=[32]) (name=down_conv_0/b2, type=float(1), shape=[32]) (name=down_conv_1/w1, type=float(1), shape=[3,3,32,64]) (name=down_conv_1/w2, type=float(1), shape=[3,3,64,64]) (name=down_conv_1/b1, type=float(1), shape=[64]) (name=down_conv_1/b2, type=float(1), shape=[64]) (name=down_conv_2/w1, type=float(1), shape=[3,3,64,128]) (name=down_conv_2/w2, type=float(1), shape=[3,3,128,128]) (name=down_conv_2/b1, type=float(1), shape=[128]) (name=down_conv_2/b2, type=float(1), shape=[128]) (name=up_conv_1/wd, type=float(1), shape=[2,2,64,128]) (name=up_conv_1/bd, type=float(1), shape=[64]) (name=up_conv_1/w1, type=float(1), shape=[3,3,128,64]) (name=up_conv_1/w2, type=float(1), shape=[3,3,64,64]) (name=up_conv_1/b1, type=float(1), shape=[64]) (name=up_conv_1/b2, type=float(1), shape=[64]) (name=up_conv_0/wd, type=float(1), shape=[2,2,32,64]) (name=up_conv_0/bd, type=float(1), shape=[32]) (name=up_conv_0/w1, type=float(1), shape=[3,3,64,32]) (name=up_conv_0/w2, type=float(1), shape=[3,3,32,32]) (name=up_conv_0/b1, type=float(1), shape=[32]) (name=up_conv_0/b2, type=float(1), shape=[32]) (name=output_map/weight, type=float(1), shape=[1,1,32,2]) (name=output_map/bias, type=float(1), shape=[2])
Found 80 possible outputs: (name=preprocessing/strided_slice_2, op=StridedSlice) (name=summaries/summary_conv_00_01, op=ImageSummary) (name=summaries/summary_conv_00_02, op=ImageSummary) (name=summaries/summary_conv_01_01, op=ImageSummary) (name=summaries/summary_conv_01_02, op=ImageSummary) (name=summaries/summary_conv_02_01, op=ImageSummary) (name=summaries/summary_conv_02_02, op=ImageSummary) (name=summaries/summary_conv_03_01, op=ImageSummary) (name=summaries/summary_conv_03_02, op=ImageSummary) (name=summaries/summary_conv_04_01, op=ImageSummary) (name=summaries/summary_conv_04_02, op=ImageSummary) (name=summaries/summary_pool_00, op=ImageSummary) (name=summaries/summary_pool_01, op=ImageSummary) (name=summaries/summary_deconv_concat_01, op=ImageSummary) (name=summaries/summary_deconv_concat_00, op=ImageSummary) (name=summaries/dw_convolution_00/activations, op=HistogramSummary) (name=summaries/dw_convolution_01/activations, op=HistogramSummary) (name=summaries/dw_convolution_02/activations, op=HistogramSummary) (name=summaries/up_convolution_1/activations, op=HistogramSummary) (name=summaries/up_convolution_0/activations, op=HistogramSummary) (name=summaries/up_convolution_out/activations, op=HistogramSummary) (name=cost/Reshape, op=Reshape) (name=cost/Reshape_1, op=Reshape) (name=cost/Mean, op=Mean) (name=gradients/cost/Mul_1_grad/Reshape_1, op=Reshape) (name=gradients/zeros_like, op=ZerosLike) (name=gradients/cost/softmax_cross_entropy_with_logits_grad/mul_1, op=Mul) (name=gradients/output_map/conv2d/BiasAdd_grad/BiasAddGrad, op=BiasAddGrad) (name=gradients/output_map/conv2d/Conv2D_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/up_conv_0/conv2d_1/dropout/mul_grad/Reshape_1, op=Reshape) (name=gradients/up_conv_0/conv2d_1/dropout/div_grad/Reshape_1, op=Reshape) (name=gradients/up_conv_0/conv2d_1/BiasAdd_grad/BiasAddGrad, op=BiasAddGrad) (name=gradients/up_conv_0/conv2d_1/Conv2D_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/up_conv_0/conv2d/dropout/mul_grad/Reshape_1, op=Reshape) (name=gradients/up_conv_0/conv2d/dropout/div_grad/Reshape_1, op=Reshape) (name=gradients/up_conv_0/conv2d/BiasAdd_grad/BiasAddGrad, op=BiasAddGrad) (name=gradients/up_conv_0/conv2d/Conv2D_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/up_conv_0/crop_and_concat/concat_grad/Shape, op=Shape) (name=gradients/up_conv_0/add_grad/Reshape_1, op=Reshape) (name=gradients/up_conv_0/deconv2d/conv2d_transpose_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/up_conv_1/conv2d_1/dropout/mul_grad/Reshape_1, op=Reshape) (name=gradients/up_conv_1/conv2d_1/dropout/div_grad/Reshape_1, op=Reshape) (name=gradients/up_conv_1/conv2d_1/BiasAdd_grad/BiasAddGrad, op=BiasAddGrad) (name=gradients/up_conv_1/conv2d_1/Conv2D_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/up_conv_1/conv2d/dropout/mul_grad/Reshape_1, op=Reshape) (name=gradients/up_conv_1/conv2d/dropout/div_grad/Reshape_1, op=Reshape) (name=gradients/up_conv_1/conv2d/BiasAdd_grad/BiasAddGrad, op=BiasAddGrad) (name=gradients/up_conv_1/conv2d/Conv2D_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/up_conv_1/crop_and_concat/concat_grad/Shape, op=Shape) (name=gradients/up_conv_1/add_grad/Reshape_1, op=Reshape) (name=gradients/up_conv_1/deconv2d/conv2d_transpose_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/down_conv_2/conv2d_1/dropout/mul_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_2/conv2d_1/dropout/div_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_2/conv2d_1/BiasAdd_grad/BiasAddGrad, op=BiasAddGrad) (name=gradients/down_conv_2/conv2d_1/Conv2D_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/down_conv_2/conv2d/dropout/mul_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_2/conv2d/dropout/div_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_2/conv2d/BiasAdd_grad/BiasAddGrad, op=BiasAddGrad) (name=gradients/down_conv_2/conv2d/Conv2D_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/down_conv_1/conv2d_1/dropout/mul_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_1/conv2d_1/dropout/div_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_1/conv2d_1/BiasAdd_grad/BiasAddGrad, op=BiasAddGrad) (name=gradients/down_conv_1/conv2d_1/Conv2D_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/down_conv_1/conv2d/dropout/mul_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_1/conv2d/dropout/div_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_1/conv2d/BiasAdd_grad/BiasAddGrad, op=BiasAddGrad) (name=gradients/down_conv_1/conv2d/Conv2D_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/down_conv_0/conv2d_1/dropout/mul_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_0/conv2d_1/dropout/div_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_0/conv2d_1/BiasAdd_grad/BiasAddGrad, op=BiasAddGrad) (name=gradients/down_conv_0/conv2d_1/Conv2D_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=gradients/down_conv_0/conv2d/dropout/mul_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_0/conv2d/dropout/div_grad/Reshape_1, op=Reshape) (name=gradients/down_conv_0/conv2d/BiasAdd_grad/BiasAddGrad, op=BiasAddGrad) (name=gradients/down_conv_0/conv2d/Conv2D_grad/Conv2DBackpropInput, op=Conv2DBackpropInput) (name=gradients/down_conv_0/conv2d/Conv2D_grad/Conv2DBackpropFilter, op=Conv2DBackpropFilter) (name=cross_entropy/Neg, op=Neg) (name=results/Mean, op=Mean) (name=save/control_dependency, op=Identity) (name=save_1/control_dependency, op=Identity)
2019-11-08 15:06:54.139399: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_0/w1
2019-11-08 15:06:54.139468: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_0/w2
2019-11-08 15:06:54.139484: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_0/b1
2019-11-08 15:06:54.139496: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_0/b2
2019-11-08 15:06:54.139515: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_1/w1
2019-11-08 15:06:54.139529: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_1/w2
2019-11-08 15:06:54.139540: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_1/b1
2019-11-08 15:06:54.139552: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_1/b2
2019-11-08 15:06:54.139569: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_2/w1
2019-11-08 15:06:54.139582: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_2/w2
2019-11-08 15:06:54.139594: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_2/b1
2019-11-08 15:06:54.139605: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodedown_conv_2/b2
2019-11-08 15:06:54.139622: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_1/wd
2019-11-08 15:06:54.139634: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_1/bd
2019-11-08 15:06:54.139668: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_1/w1
2019-11-08 15:06:54.139682: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_1/w2
2019-11-08 15:06:54.139694: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_1/b1
2019-11-08 15:06:54.139706: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_1/b2
2019-11-08 15:06:54.139724: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_0/wd
2019-11-08 15:06:54.139736: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_0/bd
2019-11-08 15:06:54.139769: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_0/w1
2019-11-08 15:06:54.139784: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_0/w2
2019-11-08 15:06:54.139796: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_0/b1
2019-11-08 15:06:54.139807: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeup_conv_0/b2
2019-11-08 15:06:54.139824: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeoutput_map/weight
2019-11-08 15:06:54.139836: W tensorflow/tools/graph_transforms/summarize_graph_main.cc:225] Decoding Tensor failed for nodeoutput_map/bias
Found 1631 (1.63k) const parameters, 0 (0) variable parameters, and 80 control_edges
6 nodes assigned to device '/device:CPU:0'Op types used: 457 Const, 105 Shape, 92 Reshape, 88 Mul, 78 Assign, 57 RealDiv, 51 StridedSlice, 49 Sum, 40 Pack, 37 Sub, 35 Add, 28 Identity, 26 VariableV2, 23 BroadcastGradientArgs, 23 Slice, 16 Max, 14 Min, 14 Transpose, 14 ImageSummary, 13 ReluGrad, 13 Relu, 13 ShapeN, 13 TruncatedNormal, 13 Conv2D, 13 Conv2DBackpropInput, 13 Conv2DBackpropFilter, 12 Neg, 11 BiasAdd, 11 BiasAddGrad, 10 RandomUniform, 10 Floor, 7 FloorDiv, 6 ConcatV2, 6 HistogramSummary, 3 Mean, 3 NoOp, 3 Placeholder, 2 RestoreV2, 2 SaveV2, 2 AddN, 2 Pad, 2 Prod, 2 Maximum, 2 MaxPoolGrad, 2 MaxPool, 2 ArgMax, 2 Cast, 2 FloorMod, 2 ConcatOffset, 2 ExpandDims, 2 Exp, 1 ZerosLike, 1 Tile, 1 Equal, 1 SoftmaxCrossEntropyWithLogits, 1 Fill, 1 Log, 1 LogSoftmax, 1 Minimum
To use with tensorflow/tools/benchmark:benchmark_model try these arguments:
bazel run tensorflow/tools/benchmark:benchmark_model -- --graph=/home/users/user/tf_unet/tmp/tmp/my_model.pb --show_flops --input_layer=x,y,dropout_probability,down_conv_0/w1,down_conv_0/w2,down_conv_0/b1,down_conv_0/b2,down_conv_1/w1,down_conv_1/w2,down_conv_1/b1,down_conv_1/b2,down_conv_2/w1,down_conv_2/w2,down_conv_2/b1,down_conv_2/b2,up_conv_1/wd,up_conv_1/bd,up_conv_1/w1,up_conv_1/w2,up_conv_1/b1,up_conv_1/b2,up_conv_0/wd,up_conv_0/bd,up_conv_0/w1,up_conv_0/w2,up_conv_0/b1,up_conv_0/b2,output_map/weight,output_map/bias --input_layer_type=float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float --input_layer_shape=-1,-1,-1,1:-1,-1,-1,2::3,3,1,32:3,3,32,32:32:32:3,3,32,64:3,3,64,64:64:64:3,3,64,128:3,3,128,128:128:128:2,2,64,128:64:3,3,128,64:3,3,64,64:64:64:2,2,32,64:32:3,3,64,32:3,3,32,32:32:32:1,1,32,2:2 --output_layer=preprocessing/strided_slice_2,summaries/summary_conv_00_01,summaries/summary_conv_00_02,summaries/summary_conv_01_01,summaries/summary_conv_01_02,summaries/summary_conv_02_01,summaries/summary_conv_02_02,summaries/summary_conv_03_01,summaries/summary_conv_03_02,summaries/summary_conv_04_01,summaries/summary_conv_04_02,summaries/summary_pool_00,summaries/summary_pool_01,summaries/summary_deconv_concat_01,summaries/summary_deconv_concat_00,summaries/dw_convolution_00/activations,summaries/dw_convolution_01/activations,summaries/dw_convolution_02/activations,summaries/up_convolution_1/activations,summaries/up_convolution_0/activations,summaries/up_convolution_out/activations,cost/Reshape,cost/Reshape_1,cost/Mean,gradients/cost/Mul_1_grad/Reshape_1,gradients/zeros_like,gradients/cost/softmax_cross_entropy_with_logits_grad/mul_1,gradients/output_map/conv2d/BiasAdd_grad/BiasAddGrad,gradients/output_map/conv2d/Conv2D_grad/Conv2DBackpropFilter,gradients/up_conv_0/conv2d_1/dropout/mul_grad/Reshape_1,gradients/up_conv_0/conv2d_1/dropout/div_grad/Reshape_1,gradients/up_conv_0/conv2d_1/BiasAdd_grad/BiasAddGrad,gradients/up_conv_0/conv2d_1/Conv2D_grad/Conv2DBackpropFilter,gradients/up_conv_0/conv2d/dropout/mul_grad/Reshape_1,gradients/up_conv_0/conv2d/dropout/div_grad/Reshape_1,gradients/up_conv_0/conv2d/BiasAdd_grad/BiasAddGrad,gradients/up_conv_0/conv2d/Conv2D_grad/Conv2DBackpropFilter,gradients/up_conv_0/crop_and_concat/concat_grad/Shape,gradients/up_conv_0/add_grad/Reshape_1,gradients/up_conv_0/deconv2d/conv2d_transpose_grad/Conv2DBackpropFilter,gradients/up_conv_1/conv2d_1/dropout/mul_grad/Reshape_1,gradients/up_conv_1/conv2d_1/dropout/div_grad/Reshape_1,gradients/up_conv_1/conv2d_1/BiasAdd_grad/BiasAddGrad,gradients/up_conv_1/conv2d_1/Conv2D_grad/Conv2DBackpropFilter,gradients/up_conv_1/conv2d/dropout/mul_grad/Reshape_1,gradients/up_conv_1/conv2d/dropout/div_grad/Reshape_1,gradients/up_conv_1/conv2d/BiasAdd_grad/BiasAddGrad,gradients/up_conv_1/conv2d/Conv2D_grad/Conv2DBackpropFilter,gradients/up_conv_1/crop_and_concat/concat_grad/Shape,gradients/up_conv_1/add_grad/Reshape_1,gradients/up_conv_1/deconv2d/conv2d_transpose_grad/Conv2DBackpropFilter,gradients/down_conv_2/conv2d_1/dropout/mul_grad/Reshape_1,gradients/down_conv_2/conv2d_1/dropout/div_grad/Reshape_1,gradients/down_conv_2/conv2d_1/BiasAdd_grad/BiasAddGrad,gradients/down_conv_2/conv2d_1/Conv2D_grad/Conv2DBackpropFilter,gradients/down_conv_2/conv2d/dropout/mul_grad/Reshape_1,gradients/down_conv_2/conv2d/dropout/div_grad/Reshape_1,gradients/down_conv_2/conv2d/BiasAdd_grad/BiasAddGrad,gradients/down_conv_2/conv2d/Conv2D_grad/Conv2DBackpropFilter,gradients/down_conv_1/conv2d_1/dropout/mul_grad/Reshape_1,gradients/down_conv_1/conv2d_1/dropout/div_grad/Reshape_1,gradients/down_conv_1/conv2d_1/BiasAdd_grad/BiasAddGrad,gradients/down_conv_1/conv2d_1/Conv2D_grad/Conv2DBackpropFilter,gradients/down_conv_1/conv2d/dropout/mul_grad/Reshape_1,gradients/down_conv_1/conv2d/dropout/div_grad/Reshape_1,gradients/down_conv_1/conv2d/BiasAdd_grad/BiasAddGrad,gradients/down_conv_1/conv2d/Conv2D_grad/Conv2DBackpropFilter,gradients/down_conv_0/conv2d_1/dropout/mul_grad/Reshape_1,gradients/down_conv_0/conv2d_1/dropout/div_grad/Reshape_1,gradients/down_conv_0/conv2d_1/BiasAdd_grad/BiasAddGrad,gradients/down_conv_0/conv2d_1/Conv2D_grad/Conv2DBackpropFilter,gradients/down_conv_0/conv2d/dropout/mul_grad/Reshape_1,gradients/down_conv_0/conv2d/dropout/div_grad/Reshape_1,gradients/down_conv_0/conv2d/BiasAdd_grad/BiasAddGrad,gradients/down_conv_0/conv2d/Conv2D_grad/Conv2DBackpropInput,gradients/down_conv_0/conv2d/Conv2D_grad/Conv2DBackpropFilter,cross_entropy/Neg,results/Mean,save/control_dependency,save_1/control_dependency

@jakeret
Copy link
Owner

jakeret commented Nov 17, 2019

you could use tensorboard to visualize the graph of the network.
The input placeholder is defined here and the output here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants