TensorRT: Error converting ResNet50 from keras


I seem to have difficulty converting ResNet to a TensorRT engine, I get the following error. Resnet should be supported since the main Tensorrt page use resnet to measure their inference improvement. Please help thanks.


Warning: No conversion function registered for layer: Merge yet.
Converting as custom op Merge bn5a_branch1/cond/Merge
name: "bn5a_branch1/cond/Merge"
op: "Merge"
input: "bn5a_branch1/cond/batchnorm/add_1"
input: "bn5a_branch1/cond/Switch_1:1"
attr {
  key: "N"
  value {
    i: 2
attr {
  key: "T"
  value {
    type: DT_FLOAT

Traceback (most recent call last):
  File "test.py", line 81, in <module>
    uff_model = uff.from_tensorflow(frozen_graph, [model_output])
  File "/home/ld-sgdev/chester_liew/.virtualenvs/dl4cv/lib/python3.5/site-packages/uff/converters/tensorflow/conversion_helpers.py", line 75, in from_tensorflow
  File "/home/ld-sgdev/chester_liew/.virtualenvs/dl4cv/lib/python3.5/site-packages/uff/converters/tensorflow/converter.py", line 64, in convert_tf2uff_graph
    uff_graph, input_replacements)
  File "/home/ld-sgdev/chester_liew/.virtualenvs/dl4cv/lib/python3.5/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/ld-sgdev/chester_liew/.virtualenvs/dl4cv/lib/python3.5/site-packages/uff/converters/tensorflow/converter.py", line 28, in convert_layer
    fields = cls.parse_tf_attrs(tf_node.attr)
  File "/home/ld-sgdev/chester_liew/.virtualenvs/dl4cv/lib/python3.5/site-packages/uff/converters/tensorflow/converter.py", line 177, in parse_tf_attrs
    for key, val in attrs.items()}
  File "/home/ld-sgdev/chester_liew/.virtualenvs/dl4cv/lib/python3.5/site-packages/uff/converters/tensorflow/converter.py", line 177, in <dictcomp>
    for key, val in attrs.items()}
  File "/home/ld-sgdev/chester_liew/.virtualenvs/dl4cv/lib/python3.5/site-packages/uff/converters/tensorflow/converter.py", line 172, in parse_tf_attr_value
    return cls.convert_tf2uff_field(code, val)
  File "/home/ld-sgdev/chester_liew/.virtualenvs/dl4cv/lib/python3.5/site-packages/uff/converters/tensorflow/converter.py", line 146, in convert_tf2uff_field
    return TensorFlowToUFFConverter.convert_tf2numpy_dtype(val)
  File "/home/ld-sgdev/chester_liew/.virtualenvs/dl4cv/lib/python3.5/site-packages/uff/converters/tensorflow/converter.py", line 74, in convert_tf2numpy_dtype
    return np.dtype(dt[dtype])
TypeError: list indices must be integers or slices, not AttrValue

Got same error. How to deal with the “Merge” op, please give some example? Thanks.

We created a new “Deep Learning Training and Inference” section in Devtalk to improve the experience for deep learning and accelerated computing, and HPC users:

We are moving active deep learning threads to the new section.

URLs for topics will not change with the re-categorization. So your bookmarks and links will continue to work as earlier.


File a NvBug here: https://developer.nvidia.com/nvidia-developer-program
Click on the link for ‘file a bug’ and provide the following information.

  • Output of 'infer_device'.
  • Link to this forum post

You will then be provided an email address where you can send us your frozen protobuf so that we can debug the issue and come back and post a solution here.

I have the same problem.

Any neural network in Keras with TF backend which uses Batchnorm won’t work with the convert_to_uff.py script. The same architectures in Caffe work just fine.

I tried to file a bug report but the system will not let me. I get error 403 forbidden.

Here is a gist containing all the error logs and package versions: