TensorRT Mask R-CNN conversion to uff fails

Hello to all,

i am facing a problem with TensorRT and matterport Mask R-CNN 2.0. I am using the official conversion script “mrcnn_to_trt_single.py” with Keras 2.1.3 and Tensorflow 1.15.0 (there was no Tensorflow 1.15.2 in Anaconda), and get this output (i had to cut the beginning):

Total params: 64,158,584
Trainable params: 64,047,096
Non-trainable params: 111,488


The output names of tensorflow graph nodes: [‘mrcnn_mask/Reshape_1’]
WARNING:tensorflow:From mrcnn_to_trt_single.py:140: convert_variables_to_constants (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.compat.v1.graph_util.convert_variables_to_constants
WARNING:tensorflow:From C:\Users\Anaconda3\envs\mask-r-cnn-keras3\lib\site-packages\tensorflow_core\python\framework\graph_util_impl.py:277: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.compat.v1.graph_util.extract_sub_graph
WARNING:tensorflow:From C:\Users\Anaconda3\envs\mask-r-cnn-keras3\lib\site-packages\uff\converters\tensorflow\conversion_helpers.py:227: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.

NOTE: UFF has been tested with TensorFlow 1.14.0.
WARNING: The version of TensorFlow installed on this system is not guaranteed to work with UFF.
UFF Version 0.6.5
=== Automatically deduced input nodes ===
[name: “input_image”
op: “Placeholder”
attr {
key: “dtype”
value {
type: DT_FLOAT
}
}
attr {
key: “shape”
value {
shape {
dim {
size: -1
}
dim {
size: -1
}
dim {
size: -1
}
dim {
size: 3
}
}
}
}
, name: “input_image_meta”
op: “Placeholder”
attr {
key: “dtype”
value {
type: DT_FLOAT
}
}
attr {
key: “shape”
value {
shape {
dim {
size: -1
}
dim {
size: 93
}
}
}
}
, name: “input_anchors”
op: “Placeholder”
attr {
key: “dtype”
value {
type: DT_FLOAT
}
}
attr {
key: “shape”
value {
shape {
dim {
size: -1
}
dim {
size: -1
}
dim {
size: 4
}
}
}
}
]

Using output node mrcnn_detection
Using output node mrcnn_mask/Sigmoid
Converting to UFF graph
Warning: No conversion function registered for layer: AddV2 yet.
Converting mrcnn_mask_bn4/batchnorm/add_1 as custom op: AddV2
WARNING:tensorflow:From C:\Users\Anaconda3\envs\mask-r-cnn-keras3\lib\site-packages\uff\converters\tensorflow\converter.py:179: The name tf.AttrValue is deprecated. Please use tf.compat.v1.AttrValue instead.

Warning: No conversion function registered for layer: AddV2 yet.
Converting mrcnn_mask_bn4/batchnorm/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting mrcnn_mask_bn3/batchnorm/add_1 as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting mrcnn_mask_bn3/batchnorm/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting mrcnn_mask_bn2/batchnorm/add_1 as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting mrcnn_mask_bn2/batchnorm/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting mrcnn_mask_bn1/batchnorm/add_1 as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting mrcnn_mask_bn1/batchnorm/add as custom op: AddV2
Warning: No conversion function registered for layer: TopKV2 yet.
Converting roi_align_mask/TopKV2 as custom op: TopKV2
Warning: No conversion function registered for layer: Range yet.
Converting roi_align_mask/range as custom op: Range
Warning: No conversion function registered for layer: Where yet.
Converting roi_align_mask/Where_3 as custom op: Where
Warning: No conversion function registered for layer: Equal yet.
Converting roi_align_mask/Equal_3 as custom op: Equal
Warning: No conversion function registered for layer: AddV2 yet.
Converting roi_align_mask/add as custom op: AddV2
Warning: No conversion function registered for layer: Cast yet.
Converting roi_align_mask/Cast as custom op: Cast
Warning: No conversion function registered for layer: Round yet.
Converting roi_align_mask/Round as custom op: Round
Warning: No conversion function registered for layer: Split yet.
Converting roi_align_mask/split as custom op: Split
Traceback (most recent call last):
File “mrcnn_to_trt_single.py”, line 167, in
main()
File “mrcnn_to_trt_single.py”, line 126, in main
text=True, list_nodes=list_nodes)
File “mrcnn_to_trt_single.py”, line 160, in convert_model
debug_mode = False
File “C:\Users\Anaconda3\envs\mask-r-cnn-keras3\lib\site-packages\uff\converters\tensorflow\conversion_helpers.py”, line 229, in from_tensorflow_frozen_model
return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs)
File “C:\Users\Anaconda3\envs\mask-r-cnn-keras3\lib\site-packages\uff\converters\tensorflow\conversion_helpers.py”, line 178, in from_tensorflow
debug_mode=debug_mode)
File “C:\Users\Anaconda3\envs\mask-r-cnn-keras3\lib\site-packages\uff\converters\tensorflow\converter.py”, line 94, in convert_tf2uff_graph
uff_graph, input_replacements, debug_mode=debug_mode)
File “C:\Users\Anaconda3\envs\mask-r-cnn-keras3\lib\site-packages\uff\converters\tensorflow\converter.py”, line 79, in convert_tf2uff_node
op, name, tf_node, inputs, uff_graph, tf_nodes=tf_nodes, debug_mode=debug_mode)
File “C:\Users\Anaconda3\envs\mask-r-cnn-keras3\lib\site-packages\uff\converters\tensorflow\converter.py”, line 47, in convert_layer
return cls.registry_[op](name, tf_node, inputs, uff_graph, **kwargs)
File “C:\Users\Anaconda3\envs\mask-r-cnn-keras3\lib\site-packages\uff\converters\tensorflow\converter_functions.py”, line 569, in convert_strided_slice
raise ValueError(“ellipsis_mask not supported”)
ValueError: ellipsis_mask not supported

How am i supposed to use Mask R-CNN with TensorRT?

Best Regards and Thanks,
Simon

I solved that problem, had to use Tensorflow 1.14.0 gpu (it seems only to work with the gpu version), as well as the NCHW update and the TensorRT preprocessor.