Custom model fails assertion "!hasWildcard(fullInferDims)"

• Hardware Platform (Jetson / GPU) RTX 3500
• DeepStream Version 7.1
• TensorRT Version 10.5.0.18
• NVIDIA GPU Driver Version (valid for GPU only) 553.05
• Issue Type (questions, new requirements, bugs) Question

Hello,
I’d like to kindly ask for help in integrating a custom model into a DeepStream pipeline.

I have a pipeline which successfully runs inference on a YOLOv7 pose estimation model using the custom output parser functions provided here. I would like to replace the YOLOv7 model with the RTMO pose estimation model. I converted the corresponding .pth file using the model creators’ indications into a .onnx file. Then, I duplicated the working YOLOv7’s nvdsinfer configuration, modifying the onnx-file property accordingly.

The .engine file of the RTMO model is successfully created when the pipeline is launched.
However, the pipeline then stops with this error:

python: nvdsinfer_backend.cpp:274: virtual NvDsInferStatus nvdsinfer::FullDimTrtBackendContext::initialize(): Assertion `!hasWildcard(fullInferDims)' failed.

As far as I understand, this indicates that at least one of the model’s layers is of dynamic size in at least one direction. I tried to insert a logging statement before the assertion call in FullDimTrtBackendContext::initialize() to identify the layers with dynamic dimension sizes, however after running make and make install, the launch of the pipeline fails with Failed to allocate cuda output buffer during context initialization before the logging statements appear in the console. I therefore abandoned this debugging approach.

I am aware that the custom output parser function has to be adjusted as the RTMO model’s output shape differs from the YOLOv7 model’s output shape, however, in the error’s backtrace below, it can be seen that the error already occurs during the deserialization of the .engine file. I therefore assume, the error is not caused by the incorrect custom output parser function. Is that assumption valid?

I’m afraid I can’t share the pipeline as it is complex and not suited as a minimal pipeline for reproducing the error. However, I don’t think the error is linked to the pipeline, as the pipeline worked well with the YOLOv7 pose estimation model. You can find the .engine file attached below, if you’d like to reproduce this error using another pipeline.

What could be the cause of the error stated above and how could it be solved?
Thank you for your time!

Appendix

  • output of an isolated call to trtexec to build the engine file

trtexec --onnx=rtmo.onnx --saveEngine=rtmo.engine --verbose

trtexec_output.txt (5.7 MB)

  • backtrace:
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=139862181790336) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=139862181790336) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=139862181790336, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007f3433adf476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007f3433ac57f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007f3433ac571b in __assert_fail_base
    (fmt=0x7f3433c7a130 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7f315f0bcbee "!hasWildcard(fullInferDims)", file=0x7f315f0bcbac "nvdsinfer_backend.cpp", line=274, function=<optimized out>)
    at ./assert/assert.c:92
#6  0x00007f3433ad6e96 in __GI___assert_fail
    (assertion=0x7f315f0bcbee "!hasWildcard(fullInferDims)", file=0x7f315f0bcbac "nvdsinfer_backend.cpp", line=274, function=0x7f315f0bcf28 "virtual NvDsInferStatus nvdsinfer::FullDimTrtBackendContext::initialize()") at ./assert/assert.c:101
#7  0x00007f315f0b17d1 in nvdsinfer::FullDimTrtBackendContext::initialize() () at ///opt/nvidia/deepstream/deepstream-7.1/lib/libnvds_infer.so
#8  0x00007f315f0b2a17 in nvdsinfer::createBackendContext(std::shared_ptr<nvdsinfer::TrtEngine> const&) () at ///opt/nvidia/deepstream/deepstream-7.1/lib/libnvds_infer.so
#9  0x00007f315f082b1d in nvdsinfer::NvDsInferContextImpl::deserializeEngineAndBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::shared_ptr<nvdsinfer::TrtEngine>&, std::unique_ptr<nvdsinfer::BackendContext, std::default_delete<nvdsinfer::BackendContext> >&) () at ///opt/nvidia/deepstream/deepstream-7.1/lib/libnvds_infer.so
#10 0x00007f315f083873 in nvdsinfer::NvDsInferContextImpl::generateBackendContext(_NvDsInferContextInitParams&) () at ///opt/nvidia/deepstream/deepstream-7.1/lib/libnvds_infer.so
#11 0x00007f315f08a774 in nvdsinfer::NvDsInferContextImpl::initialize(_NvDsInferContextInitParams&, void*, void (*)(INvDsInferContext*, unsigned int, NvDsInferLogLevel, char const*, void*)) ()
    at ///opt/nvidia/deepstream/deepstream-7.1/lib/libnvds_infer.so
#12 0x00007f315f08b0ee in createNvDsInferContext(INvDsInferContext**, _NvDsInferContextInitParams&, void*, void (*)(INvDsInferContext*, unsigned int, NvDsInferLogLevel, char const*, void*)) ()
    at ///opt/nvidia/deepstream/deepstream-7.1/lib/libnvds_infer.so
#13 0x00007f315f875f48 in  () at /usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_infer.so
#14 0x00007f333bce3441 in  () at /lib/x86_64-linux-gnu/libgstbase-1.0.so.0
#15 0x00007f333bce3675 in  () at /lib/x86_64-linux-gnu/libgstbase-1.0.so.0
  • nvdsinfer configuration file:

[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-color-format=0
onnx-file=rtmo.onnx
model-engine-file=rtmo.engine
#int8-calib-file=calib.table
labelfile-path=labels.txt
batch-size=1
network-mode=2
num-detected-classes=1
interval=0
gie-unique-id=1
process-mode=1
infer-dims=3;640;640
network-type=2
cluster-mode=4
maintain-aspect-ratio=1
symmetric-padding=1
parse-bbox-instance-mask-func-name=NvDsInferParseYoloPose
custom-lib-path=nvdsinfer_custom_impl_yolo_pose/libnvdsinfer_custom_impl_yolo_pose.so
output-instance-mask=1
[class-attrs-all]
pre-cluster-threshold=0.4
topk=300

Since TRT engine is device dependent, it can be used at my side. could you share the onnx
model if possible? You can use forum private email. please click forum avatar-> personal messages->new message. or you can share the model input and output layers after opening by Netron tool. could you share the whole DeepStream running log?

Thank you for your reply.

Due to size restrictions imposed by the forum’s upload functionality, I split the .onnx file in two archive files using 7-Zip. You’d need to extract both .zip files to get the two parts in 7-Zip file format and then extract rtmo.7z.001 using 7-Zip. Please let me know if you’d prefer another method of file sharing.

rtmo.7z.001.zip (86.0 MB)
rtmo.7z.002.zip (68.4 MB)

Whole DeepStream running log:

max_fps_dur 8.33333e+06 min_fps_dur 2e+08
max_fps_dur 8.33333e+06 min_fps_dur 2e+08
max_fps_dur 8.33333e+06 min_fps_dur 2e+08
NVDSMETAMUX_CFG_PARSER: Group 'user-configs' ignored
gstnvtracker: Loading low-level lib at /opt/nvidia/deepstream/deepstream/lib/libnvds_nvmultiobjecttracker.so
[NvMultiObjectTracker] Initialized
gstnvtracker: Forcing format RGBA for tracker 
python: nvdsinfer_backend.cpp:274: virtual NvDsInferStatus nvdsinfer::FullDimTrtBackendContext::initialize(): Assertion `!hasWildcard(fullInferDims)' failed.
Aborted
  1. this is only the error log. could you share the whole log, including generating engine?
  2. can you try using DeepStream to generate engine instead of using trtexec? you can comment out “model-engine-file=rtmo.engine” first, then run the app again. if app still can’t work, please share the whole log? Thanks!

Thank you for your reply.

This is the log when the .engine file is created via DeepStream:

(gst-plugin-scanner:3924): GStreamer-WARNING **: 09:45:12.489: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_udp.so': librivermax.so.1: cannot open shared object file: No such file or directory
(gst-plugin-scanner:3924): GStreamer-WARNING **: 09:45:12.629: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_inferserver.so': libtritonserver.so: cannot open shared object file: No such file or directory
max_fps_dur 8.33333e+06 min_fps_dur 2e+08
max_fps_dur 8.33333e+06 min_fps_dur 2e+08
max_fps_dur 8.33333e+06 min_fps_dur 2e+08
NVDSMETAMUX_CFG_PARSER: Group 'user-configs' ignored
gstnvtracker: Loading low-level lib at /opt/nvidia/deepstream/deepstream/lib/libnvds_nvmultiobjecttracker.so
[NvMultiObjectTracker] Initialized
gstnvtracker: Forcing format RGBA for tracker 
0:00:05.695114782  3884 0x5603b6b58400 INFO                 nvinfer gstnvinfer.cpp:684:gst_nvinfer_logger:<RTMO> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:2106> [UID = 1]: Trying to create engine from model files
WARNING: [TRT]: Detected layernorm nodes in FP16.
WARNING: [TRT]: Running layernorm after self-attention with FP16 Reduce or Pow may cause overflow. Forcing Reduce or Pow Layers in FP32 precision, or exporting the model to use INormalizationLayer (available with ONNX opset >= 17) can help preserving accuracy.
0:03:16.914164410  3884 0x5603b6b58400 INFO                 nvinfer gstnvinfer.cpp:684:gst_nvinfer_logger:<RTMO> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:2138> [UID = 1]: serialize cuda engine to file: rtmo.engine successfully
python: nvdsinfer_backend.cpp:274: virtual NvDsInferStatus nvdsinfer::FullDimTrtBackendContext::initialize(): Assertion `!hasWildcard(fullInferDims)' failed.
Aborted

nvinfer low-level lib is openosurce. can you please add the follow code in FullDimTrtBackendContext::initialize to print the actual value? please refer to /opt/nvidia/deepstream/deepstream-7.1/sources/libs/nvdsinfer/REAMDE for how to build. especially please backup the original /opt/nvidia/deepstream/deepstream/lib/libnvds_infer.so.

        for(int i = 0; i < fullInferDims.nbDims; i++) {
            printf("dim:%d\n", fullInferDims.d[i]);
        }
        assert(!hasWildcard(fullInferDims));

Thank you for your reply.

Adding the print statement yields this log:

(gst-plugin-scanner:3924): GStreamer-WARNING **: 09:45:12.489: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_udp.so': librivermax.so.1: cannot open shared object file: No such file or directory
(gst-plugin-scanner:3924): GStreamer-WARNING **: 09:45:12.629: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_inferserver.so': libtritonserver.so: cannot open shared object file: No such file or directory
max_fps_dur 8.33333e+06 min_fps_dur 2e+08
max_fps_dur 8.33333e+06 min_fps_dur 2e+08
max_fps_dur 8.33333e+06 min_fps_dur 2e+08
NVDSMETAMUX_CFG_PARSER: Group 'user-configs' ignored
gstnvtracker: Loading low-level lib at /opt/nvidia/deepstream/deepstream/lib/libnvds_nvmultiobjecttracker.so
[NvMultiObjectTracker] Initialized
gstnvtracker: Forcing format RGBA for tracker 
dim:1
dim:3
dim:640
dim:640
dim:1
dim:-1
dim:5
dim:1
dim:-1
dim:17
dim:3
0:00:02.951221538 14538 0x5600c96aa200 INFO                 nvinfer gstnvinfer.cpp:684:gst_nvinfer_logger:<RTMO> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:2092> [UID = 1]: deserialized trt engine from :rtmo.engine
Implicit layer support has been deprecated
INFO: [Implicit Engine Info]: layers num: 0

0:00:02.951260210 14538 0x5600c96aa200 INFO                 nvinfer gstnvinfer.cpp:684:gst_nvinfer_logger:<RTMO> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2195> [UID = 1]: Use deserialized engine model: rtmo.engine
0:00:02.952470058 14538 0x5600c96aa200 ERROR                nvinfer gstnvinfer.cpp:678:gst_nvinfer_logger:<RTMO> NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::resizeOutputBufferpool() <nvdsinfer_context_impl.cpp:1462> [UID = 1]: Failed to allocate cuda output buffer during context initialization
0:00:02.952489135 14538 0x5600c96aa200 ERROR                nvinfer gstnvinfer.cpp:678:gst_nvinfer_logger:<RTMO> NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::allocateBuffers() <nvdsinfer_context_impl.cpp:1594> [UID = 1]: Failed to allocate output bufferpool

0:00:02.952501950 14538 0x5600c96aa200 ERROR                nvinfer gstnvinfer.cpp:678:gst_nvinfer_logger:<RTMO> NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::initialize() <nvdsinfer_context_impl.cpp:1374> [UID = 1]: Failed to allocate buffers
Segmentation fault

We see the following shapes.

input binding: [1, 3, 640, 640]
output binding (bounding boxes): [1, -1, 5]
output binding (keypoints): [1, -1, 17, 3]

If I understand this log correctly, the two output bindings are of dynamic size in the batch dimension.
However, that is to be expected, right? What does the leading “1” dimension mean in the output shapes?

hasWildcard is opensource. nvinfer does not support -1 in layer dimension.
please modify the model output. please refer to other pose estimation samples. bodypose2d, deepstream-pose-classification.