KeyError: 'mrcnn_class_bn1/Reshape_5/shape' while converting to .uff for custom model MaskRCNN in Xavier NX

While using a custom model,during the .h5 to uff conversion,received an error like this.Any help will be highly appreciated !

P.S - I was able to optimise the pretrained model from GitHub - matterport/Mask_RCNN: Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow in Nvidia Jetson Xavier NX.But When I tried to optimise the custom model I trained,it is showing this error.


TensorRT Version:
Nvidia Driver Version: 32.4.3
CUDA Version: 10.2.89
CUDNN Version: 8.0.0
Operating System + Version: Ubuntu 18.04.5 LTS
Python Version : python3.6
TensorFlow Version : 1.15.2
Jetpack version - 4.4
keras version - 2.1.3

This looks like a Jetson issue, moving into Jetson Xavier NX forum for resolution.


Could you share the complete error/log with us?


Thank you for your reply.

Please go through the log attached.
log.txt (8.3 KB)


I removed ‘mrcnn_class_bn1/Reshape_5/shape’,‘mrcnn_class_bn1/Reshape_5’, ‘mrcnn_class_bn2/Reshape_5/shape’, ‘mrcnn_class_bn2/Reshape_5’, ‘mrcnn_mask_bn1/Reshape_5/shape’, ‘mrcnn_mask_bn1/Reshape_5’, ‘mrcnn_mask_bn2/Reshape_5/shape’, ‘mrcnn_mask_bn1/Reshape_5’, ‘mrcnn_mask_bn2/Reshape_5’,‘mrcnn_mask_bn3/Reshape_5/shape’, ‘mrcnn_mask_bn3/Reshape_5’,‘mrcnn_mask_bn4/Reshape_5/shape’, ‘mrcnn_mask_bn4/Reshape_5’ from .

Then I received this error :

Using output node mrcnn_detection
Using output node mrcnn_mask/Sigmoid
Converting to UFF graph
Traceback (most recent call last):
File “…/…/”, line 186, in
File “…/…/”, line 143, in main
text=True, list_nodes=list_nodes)
File “…/…/”, line 179, in convert_model
debug_mode = False
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 276, in from_tensorflow_frozen_model
return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs)
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 225, in from_tensorflow
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 141, in convert_tf2uff_graph
uff_graph, input_replacements, debug_mode=debug_mode)
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 126, in convert_tf2uff_node
op, name, tf_node, inputs, uff_graph, tf_nodes=tf_nodes, debug_mode=debug_mode)
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 94, in convert_layer
return cls.registry_[op](name, tf_node, inputs, uff_graph, **kwargs)
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 337, in convert_reshape
uff_graph.reshape(inputs[0], inputs[1], name)
IndexError: list index out of range

uff version used is 0.6.9

Hi ,
The issue isnt still not solved.I worked around it several times.
I saved the pb file in binary to view the nodes.But since it was too big,I was unable to open.

I edited the config file and I have attached it here.

Once I run the script,I am obtaining this error.

P.S : whenever key error was obtaining I removed those layers.That is how I edited the file. (7.8 KB)


Sorry for the late update.

The error shared in the log.txt file (Apr 23) is caused by the incorrect definition in the
It seems that you try to remove the layer which doesn’t exist in your .pb file.

For the second error shared in Apr 30.
The “list index out of range” error indicates the converter expects two input but you only have one on a certain layer.

To give a further suggestion, would you mind to share the .pb file with us?

Hi ,
It’s okay.
I removed some layers when it showed the key error.I tried opening the .pb in binary to check whether the nodes I removed are the correct ones or not.But since it was a file with large size,it was making my system hang.

I also debugged the and its only returning one value like you said.

I have attached the .pb file here.