Convert ONNX model to TRT with custom layers


I was able to convert a Pytorch model which uses a custom deformable convolution layer to ONNX.
(model is centernet based on with the deformed convolution replaced with

While I was able to define the operation of the deformable convolution and create an onnx model, when trying to convert it to TensorRT the process fails as it doesn’t recognize the DCN layer:

`In node 135 (parseGraph): UNSUPPORTED_NODE: No importer registered for op: DCNv2_2`

Within these repos a cuda implementation was provided under

but these file are not seem to be complied during the building of the repo.

Can someone please provide a recipe on how to take a cuda implemented layer (.cu) and import it to TensorRT so that the conversion of an onnx model with the layer is processed smoothly?

Thanks in advanced


TensorRT Version: 0.0.1
GPU Type: Ti2080
Nvidia Driver Version: 440.100
CUDA Version: 10.1
CUDNN Version: 7
Operating System + Version: ubuntu 18.4
Python Version (if applicable): 3.7
TensorFlow Version (if applicable): -
PyTorch Version (if applicable): 1.7
Baremetal or Container (if container which image + tag):

Steps To Reproduce

To reproduce, follow installation instruction on both given repos

Hi @shai.rozenberg,

The error says that DCNv2_2 is not supported curently by onnx.
Hence you will need to add custom plugin for the same.
Please refer to the samples below for the implementation of custom plugin.