Error Code 4: Internal Error (/TopK: K exceeds the maximum value allowed (3840) (TensorRT 8.6)

Description

When converting .onnx model file using TensorRT 8.6 using the command line, the following error occurs

Error Code 4: Internal Error (/TopK: K exceeds the maximum value allowed (3840).)

The command - .\bin\trtexec.exe --onnx=rtmdet_file.onnx --saveEngine=model.engine --fp16 --shapes=input:1x3x1280x1280 --verbose

Even without any shapes specified, it outputs the same error.

Environment

TensorRT Version: 8.6
GPU Type: NVIDIA GeForce RTX 3050 Ti
Nvidia Driver Version: 551.52
CUDA Version: 11.1
CUDNN Version: 8.0.5
Operating System + Version: Windows 10.0
Python Version (if applicable): none
TensorFlow Version (if applicable): none
PyTorch Version (if applicable): none
Baremetal or Container (if container which image + tag): none

Console output

[05/21/2024-16:22:30] [V] [TRT] Using Gather axis: 1
[05/21/2024-16:22:30] [V] [TRT] Registering layer: /Gather_16 for ONNX node: /Gather_16
[05/21/2024-16:22:30] [V] [TRT] Registering tensor: dets_36 for ONNX tensor: dets
[05/21/2024-16:22:30] [V] [TRT] /Gather_16 [Gather] outputs: [dets -> (1, -1, 5)[FLOAT]],
[05/21/2024-16:22:30] [V] [TRT] Parsing node: /Gather_17 [Gather]
[05/21/2024-16:22:30] [V] [TRT] Searching for input: /Concat_11_output_0
[05/21/2024-16:22:30] [V] [TRT] Searching for input: /Squeeze_1_output_0
[05/21/2024-16:22:30] [V] [TRT] /Gather_17 [Gather] inputs: [/Concat_11_output_0 -> (1, -1)[INT32]], [/Squeeze_1_output_0 -> (-1)[INT32]],
[05/21/2024-16:22:30] [V] [TRT] Using Gather axis: 1
[05/21/2024-16:22:30] [V] [TRT] Registering layer: /Gather_17 for ONNX node: /Gather_17
[05/21/2024-16:22:30] [V] [TRT] Registering tensor: labels_37 for ONNX tensor: labels
[05/21/2024-16:22:30] [V] [TRT] /Gather_17 [Gather] outputs: [labels -> (1, -1)[INT32]],
[05/21/2024-16:22:30] [V] [TRT] Marking dets_36 as output: dets
[05/21/2024-16:22:30] [V] [TRT] Marking labels_37 as output: labels
[05/21/2024-16:22:30] [I] Finished parsing network model. Parse time: 1.57851
[05/21/2024-16:22:30] [E] Error[4]: [graphShapeAnalyzer.cpp::nvinfer1::builder::`anonymous-namespace'::ShapeAnalyzerImpl::processCheck::862] Error Code 4: Internal Error (/TopK: K exceeds the maximum value allowed (3840).)
[05/21/2024-16:22:30] [E] Engine could not be created from network
[05/21/2024-16:22:30] [E] Building engine failed
[05/21/2024-16:22:30] [E] Failed to create engine from model or file.
[05/21/2024-16:22:30] [E] Engine set up failed
&&&& FAILED TensorRT.trtexec [TensorRT v8601] # C:\Program Files\NVIDIA GPU Computing Toolkit\TensorRT-8.6.1.6\bin\trtexec.exe --onnx=rtmdet_s_upscale2_E135.onnx --saveEngine=model_3.engine --fp16 --verbose

Hi @s.dev ,
Would you mind sharing the onnx model with us?

Hello,
Sorry for the delay, Here is the onnx file:
end2end.zip (35.7 MB)

The command to reproduce the error:

trtexec.exe --onnx=end2end.onnx --saveEngine=model.engine --fp16 --shapes=input:1x3x640x640 --verbose