NVIDIA / TensorRT

NVIDIA® TensorRT™ is an SDK for high-performance deep learning inference on NVIDIA GPUs. This repository contains the open source components of TensorRT.
https://developer.nvidia.com/tensorrt
Apache License 2.0
10.68k stars 2.12k forks source link

Get the layer attributes #4102

Open Egorundel opened 1 month ago

Egorundel commented 1 month ago

Description

Greetings to all, you can tell me I have an EfficientNMS_TRT layer in the ONNX model, but its type is not nvinfer1::LayerType::kNMS.

check the screenshot: Image

If I try to bring this layer to dynamic_cast<nvinfer1::INMSLayer>*, then I still don't have the attributes that are inherent in INMSLayer.

How can I get the layer attributes?

Environment

TensorRT Version: 8.6.1.6 NVIDIA GPU: RTX3060 NVIDIA Driver Version: 555.42.02 CUDA Version: 11.1

akhilg-nv commented 1 month ago

Can you provide more information about why you are using EfficientNMS_TRT layer? It appears to be a plugin so it will not necessarily map 1:1 to nvinfer1::LayerType::kNMS. If you want to create an nvinfer1::LayerType::kNMS layer instead, you may look into replacing this plugin.

Egorundel commented 1 month ago

@akhilg-nv I am using this export-det.py python file to create an ONNX model with a dynamic batch size:

https://github.com/triple-Mu/YOLOv8-TensorRT/blob/main/export-det.py

Egorundel commented 1 month ago

@akhilg-nv type of this layer is pluginV2

moraxu commented 1 month ago

@samurdhikaru - could you advise on this one , i.e. if such casting is somehow doable in terms of plugins?

samurdhikaru commented 3 weeks ago

@Egorundel EfficientNMS_TRT refers to a TensorRT plugin layer (specifically efficientNMSPlugin), whereas INMSLayer refers to a layer of the inbuilt NMS operator in TensorRT. While the plugin and the inbuilt NMS op are similar in functionality, casting an IPluginV2Layer to an INMSLayer is not possible.

You have a couple of options: