How to use tensorrt ResizeNearest Plugin? (Function not implemented Segmentation fault (core dumped))

Hi,

I’ve tried deploying yolov3 using tensorflow on jetson nano. I need to implement ResizeNearest plugin on tensorrt. But I always get failure when building the network.

Here is my piece of code.

import graphsurgeon as gs
import pycuda.driver as cuda
import tf2onnx
import pycuda.autoinit
import tensorrt as trt

TRT_LOGGER = trt.Logger(trt.Logger.WARNING)
trt.init_libnvinfer_plugins(TRT_LOGGER, ‘’)
trt_runtime = trt.Runtime(TRT_LOGGER)

dynamic_graph = gs.DynamicGraph(frozen_graph)
trt_upsampled = gs.create_plugin_node(
name=“trt_upsampled”,
op=“ResizeNearest”,
scale=2.0)
namespace_plugin_map = {
“yolov3/yolov3_head/upsampled”: trt_upsampled
}

dynamic_graph.collapse_namespaces(namespace_plugin_map)

uff_model = uff.from_tensorflow(
dynamic_graph.as_graph_def(),
output_filename=model_path,
text=True)

with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as network, trt.UffParser() as parser:
builder.max_workspace_size = 4 << 30
parser.register_input(“image_tensor”, [3, img_size, img_size])
parser.register_output(“yolov3/yolov3_head/upsampled”)
parser.parse(model_path, network)

Here is error from that piece of code.

[name: “trt_upsampled”
op: “ResizeNearest”
input: “yolov3/yolov3_head/Conv_7/LeakyRelu”
attr {
key: “scale_u_float”
value {
f: 2.0
}
}
]

Using output node trt_upsampled
Converting to UFF graph
Warning: No conversion function registered for layer: ResizeNearest yet.
Converting trt_upsampled as custom op: ResizeNearest
DEBUG [/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py:96] Marking [‘trt_upsampled’] as outputs
No. nodes: 490
UFF Output written to /workspace/tensorrt/yolo_deployment/YOLOv3_TensorFlow/frozen_inference_graph.uff
UFF Text Output written to /workspace/tensorrt/yolo_deployment/YOLOv3_TensorFlow/frozen_inference_graph.pbtxt
Function not implemented
Segmentation fault (core dumped)

Thanks for your help.

Hi,

Please make sure plugin “op” matches the registered plugin name and the parameters have the same name and type as expected by the plugin.

Eg:
Registered plugin name: “ResizeNearest_TRT”
https://github.com/NVIDIA/TensorRT/blob/07ed9b57b1ff7c24664388e5564b17f7ce2873e5/plugin/resizeNearestPlugin/resizeNearestPlugin.cpp

Documentation link:
https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html#example2_add_custom_layer_no_uff_python

Below refer to below samples:
https://github.com/NVIDIA/TensorRT/blob/07ed9b57b1ff7c24664388e5564b17f7ce2873e5/samples/opensource/sampleUffSSD/config.py
https://github.com/NVIDIA/TensorRT/blob/07ed9b57b1ff7c24664388e5564b17f7ce2873e5/samples/opensource/sampleUffMaskRCNN/converted/config.py

Thanks