ERROR: convert mask rcnn uff model to .engine model

Hello,

I am trying to build object detector by mask rcnn.

I use “mask_rcnn_coco.h5” model file from model link, and I use this repo to convert .h5 to uff model. It’s ok.

But when I convert from uff to engine file, I have some problem:

[TensorRT] ERROR: UffParser: Validator error: roi_align_mask_trt: Unsupported operation _PyramidROIAlign_TRT
[TensorRT] ERROR: Network must have at least one output
Traceback (most recent call last):
File “convert.py”, line 45, in
main()
File “convert.py”, line 38, in main
with build_engine_uff(uff_model_file) as engine:
AttributeError: enter

convert.py

import tensorrt as trt

class ModelData(object):
    MODEL_PATH = "/home/nvidia/sampleUffMaskRCNN/data_05/mrcnn_nchw.uff"
    INPUT_NAME = "input_image"
    INPUT_SHAPE = (3,1024,1024)
    OUTPUT_NAME = ["mrcnn_detection", "mrcnn_mask/Sigmoid"]
    DTYPE = trt.float32

TRT_LOGGER = trt.Logger(trt.Logger.WARNING)


def build_engine_uff(model_file):
    with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as network, trt.UffParser() as parser:
        builder.max_workspace_size = 1 << 20
        parser.register_input(ModelData.INPUT_NAME, ModelData.INPUT_SHAPE)
        parser.register_output(ModelData.OUTPUT_NAME[0])
        parser.register_output(ModelData.OUTPUT_NAME[1])
        parser.parse(model_file, network)
        return builder.build_cuda_engine(network)


def main():
    uff_model_file = ModelData.MODEL_PATH
    with build_engine_uff(uff_model_file) as engine:
        with open('{}_{}.engine'.format("mask", 'rcnn'), 'wb') as f:
            print("writing engine")
            f.write(engine.serialize())
 

if __name__ == '__main__':
    main()

How can I fix it?

Many thanks !

Link model: GitHub - matterport/Mask_RCNN: Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Link convert .h to uff: TensorRT/samples/opensource/sampleUffMaskRCNN at release/6.0 · NVIDIA/TensorRT · GitHub

Hi,

Could you please share the set-up details so we can better help?

Environment

TensorRT Version :
GPU Type :
Nvidia Driver Version :
CUDA Version :
CUDNN Version :
Operating System + Version :
Python Version (if applicable) :
TensorFlow Version (if applicable) :
PyTorch Version (if applicable) :
Baremetal or Container (if container which image + tag) :

Thanks

Hi SunilJB,

My device info:

Jetson

TensorRT Version : 5.1
GPU Type : NVIDIA Tegra X2
Nvidia Driver Version : 32.2.3
CUDA Version : 10.0.326
CUDNN Version : v7
#define CUDNN_MAJOR 7
#define CUDNN_MINOR 5
#define CUDNN_PATCHLEVEL 0

Operating System + Version : Ubuntu 18.04.3 LTS
Python Version (if applicable) : 3.6.9
TensorFlow Version (if applicable) : 1.14.0
PyTorch Version (if applicable) : None
Baremetal or Container (if container which image + tag) : None

Thanks

MaskRCNN samples support was added in TRT 6. Request you to please try TRT6 release.
In TRT 6 this sample is available only in GitHub and is not packaged with the product.

Thanks

Hi SunilJB,

I will try, thanks you!