I get an error when I'm tring to convert my tensorflow model to tensorrt

Hello. When I was trying to convert my TF model to uff format with uff.from_tensorflow_frozen_model method., I got an error (tensorRT 3.0 + tensorflow 1.4.0)
Using output node convolutional_alexnet/conv5/concat
Converting to UFF graph
Traceback (most recent call last):
File “ckpt2pb.py”, line 51, in
uff_model = uff.from_tensorflow(frozen_graph,output)
File “/home/xucheng/local/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/conversion_helpers.py”, line 75, in from_tensorflow
name=“main”)
File “/home/xucheng/local/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py”, line 64, in convert_tf2uff_graph
uff_graph, input_replacements)
File “/home/xucheng/local/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py”, line 51, in convert_tf2uff_node
op, name, tf_node, inputs, uff_graph, tf_nodes=tf_nodes)
File “/home/xucheng/local/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py”, line 32, in convert_layer
return cls.registry_[op](name, tf_node, inputs, uff_graph, **kwargs)
File “/home/xucheng/local/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter_functions.py”, line 244, in convert_conv2d
return _conv2d_helper(name, tf_node, inputs, uff_graph, func=“conv2d”, **kwargs)
File “/home/xucheng/local/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter_functions.py”, line 260, in _conv2d_helper
tf_node, inputs, kwargs[“tf_nodes”])
File “/home/xucheng/local/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py”, line 114, in apply_fused_padding
tf_lhs_node = tf_nodes[inputs[0]]
KeyError: u’convolutional_alexnet/conv5/split:1’

Here is my tensorflow code
with tf.variable_scope(scope, ‘convolutional_alexnet’, [inputs], reuse=reuse) as sc:
end_points_collection = sc.name + ‘_end_points’
with slim.arg_scope([slim.conv2d, slim.max_pool2d],
outputs_collections=end_points_collection):
net = inputs
net = slim.conv2d(net, 96, [11, 11], 2, scope=‘conv1’)
net = slim.max_pool2d(net, [3, 3], 2, scope=‘pool1’)
with tf.variable_scope(‘conv2’):
b1, b2 = tf.split(net, 2, 3)
b1 = slim.conv2d(b1, 128, [5, 5], scope=‘b1’)
# The original implementation has bias terms for all convolution, but
# it actually isn’t necessary if the convolution layer is followed by a batch
# normalization layer since batch norm will subtract the mean.
b2 = slim.conv2d(b2, 128, [5, 5], scope=‘b2’)
net = tf.concat([b1, b2], 3)
net = slim.max_pool2d(net, [3, 3], 2, scope=‘pool2’)
net = slim.conv2d(net, 384, [3, 3], 1, scope=‘conv3’)
with tf.variable_scope(‘conv4’):
b1, b2 = tf.split(net, 2, 3)
b1 = slim.conv2d(b1, 192, [3, 3], 1, scope=‘b1’)
b2 = slim.conv2d(b2, 192, [3, 3], 1, scope=‘b2’)
net = tf.concat([b1, b2], 3)
# Conv 5 with only convolution, has bias
with tf.variable_scope(‘conv5’):
with slim.arg_scope([slim.conv2d],
activation_fn=None, normalizer_fn=None):
b1, b2 = tf.split(net, 2, 3 , name = ‘split’)
b1 = slim.conv2d(b1, 128, [3, 3], 1, scope=‘b1’)
b2 = slim.conv2d(b2, 128, [3, 3], 1, scope=‘b2’)
net = tf.concat([b1, b2], 3)
# Convert end_points_collection into a dictionary of end_points.
end_points = slim.utils.convert_collection_to_dict(end_points_collection)
return net, end_points

Can you help me fix this problem ? Thanks

Hello,

Are you able to validate that the variable ‘output’ that you provide to uff.from_tensorflow is in the TensorFlow graph?

It may help to visualize the graph using Tensorboard to verify the output name. You may export the frozen graph for visualization by calling

tf.summary.FileWriter(graph_def=frozen_graph, logdir='logs')

And then launch Tensorboard pointing it to the log directory.

tensorboard --logdir=logs

We provide instructions for how to interpret the tensorboard graph visualization for this purpose in the TensorFlow to TensorRT on Jetson webinar.