Hi,
I converted this onnx model to TensorRT using
/usr/src/tensorrt/bin/trtexec --onnx=darknet-53_b1_sim.onnx --workspace=64 --fp16 --saveEngine=darknet-53_b1.engine
The conversion worked with ScatterND
plugin being created during the process.
[06/09/2022-03:34:48] [W] [TRT] onnx2trt_utils.cpp:390: One or more weights outside the range of INT32 was clamped
[06/09/2022-03:34:48] [I] [TRT] No importer registered for op: ScatterND. Attempting to import as plugin.
[06/09/2022-03:34:48] [I] [TRT] Searching for plugin: ScatterND, plugin_version: 1, plugin_namespace:
[06/09/2022-03:34:48] [I] [TRT] Successfully created plugin: ScatterND
[06/09/2022-03:34:48] [I] [TRT] No importer registered for op: ScatterND. Attempting to import as plugin.
[06/09/2022-03:34:48] [I] [TRT] Searching for plugin: ScatterND, plugin_version: 1, plugin_namespace:
[06/09/2022-03:34:48] [I] [TRT] Successfully created plugin: ScatterND
[06/09/2022-03:34:48] [I] [TRT] No importer registered for op: ScatterND. Attempting to import as plugin.
[06/09/2022-03:34:48] [I] [TRT] Searching for plugin: ScatterND, plugin_version: 1, plugin_namespace:
[06/09/2022-03:34:48] [I] [TRT] Successfully created plugin: ScatterND
[06/09/2022-03:34:48] [I] [TRT] No importer registered for op: ScatterND. Attempting to import as plugin.
[06/09/2022-03:34:48] [I] [TRT] Searching for plugin: ScatterND, plugin_version: 1, plugin_namespace:
[06/09/2022-03:34:48] [I] [TRT] Successfully created plugin: ScatterND
[06/09/2022-03:34:48] [I] [TRT] No importer registered for op: ScatterND. Attempting to import as plugin.
[06/09/2022-03:34:48] [I] [TRT] Searching for plugin: ScatterND, plugin_version: 1, plugin_namespace:
[06/09/2022-03:34:48] [I] [TRT] Successfully created plugin: ScatterND
[06/09/2022-03:34:48] [I] [TRT] No importer registered for op: ScatterND. Attempting to import as plugin.
[06/09/2022-03:34:48] [I] [TRT] Searching for plugin: ScatterND, plugin_version: 1, plugin_namespace:
[06/09/2022-03:34:48] [I] [TRT] Successfully created plugin: ScatterND
[06/09/2022-03:34:48] [I] [TRT] No importer registered for op: ScatterND. Attempting to import as plugin.
[06/09/2022-03:34:48] [I] [TRT] Searching for plugin: ScatterND, plugin_version: 1, plugin_namespace:
[06/09/2022-03:34:48] [I] [TRT] Successfully created plugin: ScatterND
[06/09/2022-03:34:48] [I] [TRT] No importer registered for op: ScatterND. Attempting to import as plugin.
[06/09/2022-03:34:48] [I] [TRT] Searching for plugin: ScatterND, plugin_version: 1, plugin_namespace:
[06/09/2022-03:34:48] [I] [TRT] Successfully created plugin: ScatterND
[06/09/2022-03:34:48] [I] [TRT] No importer registered for op: ScatterND. Attempting to import as plugin.
[06/09/2022-03:34:48] [I] [TRT] Searching for plugin: ScatterND, plugin_version: 1, plugin_namespace:
[06/09/2022-03:34:48] [I] [TRT] Successfully created plugin: ScatterND
I created a simple app that runs TensorRT engine file (no DeepStream) to verify the engine and the inference worked fine with initLibNvInferPlugins(nullptr, "");
added to the code. However, when I ran a simple DeepStream app based on deepstream_test1_app.c
, with the same engine. I got
root@64af4ac4e10d:/project# ./bin/test_reid /opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264
Now playing: /opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264
0:00:01.719414205 498 0x56386ca3b230 INFO nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary-nvinference-engine> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1900> [UID = 1]: deserialized trt engine from :/project/models/people_reid/darknet-53_b1.engine
INFO: ../nvdsinfer/nvdsinfer_model_builder.cpp:610 [Implicit Engine Info]: layers num: 2
0 INPUT kFLOAT input 3x608x1088
1 OUTPUT kFLOAT output 54264x518
0:00:01.719457301 498 0x56386ca3b230 INFO nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary-nvinference-engine> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2004> [UID = 1]: Use deserialized engine model: /project/models/people_reid/darknet-53_b1.engine
0:00:01.856497390 498 0x56386ca3b230 INFO nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus:<primary-nvinference-engine> [UID 1]: Load new model:configs/people_reid/pgie.cfg sucessfully
Running...
Failed to establish dbus connectionERROR: nvdsinfer_context_impl.cpp:1763 Failed to synchronize on cuda copy-coplete-event, cuda err_no:700, err_str:cudaErrorIllegalAddress
ERROR: [TRT]: 1: [slice.cu::launchNaiveSliceImpl::148] Error Code 1: Cuda Runtime (an illegal memory access was encountered)
ERROR: nvdsinfer_backend.cpp:506 Failed to enqueue trt inference batch
ERROR: nvdsinfer_context_impl.cpp:1643 Infer context enqueue buffer failed, nvinfer error:NVDSINFER_TENSORRT_ERROR
0:00:02.174864705 498 0x56386c1d3d40 WARN nvinfer gstnvinfer.cpp:2325:gst_nvinfer_output_loop:<primary-nvinference-engine> error: Failed to dequeue output from inferencing. NvDsInferContext error: NVDSINFER_CUDA_ERROR
0:00:02.175048840 498 0x56386c1d3d40 WARN nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-nvinference-engine> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::releaseBatchOutput() <nvdsinfer_context_impl.cpp:1789> [UID = 1]: Tried to release an unknown outputBatchID
ERROR from element primary-nvinference-engine: Failed to dequeue output from inferencing. NvDsInferContext error: NVDSINFER_CUDA_ERROR
Error details: gstnvinfer.cpp(2325): gst_nvinfer_output_loop (): /GstPipeline:dstest1-pipeline/GstNvInfer:primary-nvinference-engine
Cuda failure: status=700
Error(-1) in buffer allocation
0:00:02.175101258 498 0x56386c1d3d90 WARN nvinfer gstnvinfer.cpp:1324:gst_nvinfer_input_queue_loop:<primary-nvinference-engine> error: Failed to queue input batch for inferencing
Returned, stopping playback
** (test_reid:498): CRITICAL **: 03:42:26.526: gst_nvds_buffer_pool_alloc_buffer: assertion 'mem' failed
0:00:02.175176211 498 0x56386c1d3d40 WARN nvinfer gstnvinfer.cpp:2288:gst_nvinfer_output_loop:<primary-nvinference-engine> error: Internal data stream error.
0:00:02.175182255 498 0x56386c1d3d40 WARN nvinfer gstnvinfer.cpp:2288:gst_nvinfer_output_loop:<primary-nvinference-engine> error: streaming stopped, reason error (-5)
ERROR: nvdsinfer_context_impl.cpp:1763 Failed to synchronize on cuda copy-coplete-event, cuda err_no:700, err_str:cudaErrorIllegalAddress
0:00:02.175212917 498 0x56386c1d3d40 WARN nvinfer gstnvinfer.cpp:2325:gst_nvinfer_output_loop:<primary-nvinference-engine> error: Failed to dequeue output from inferencing. NvDsInferContext error: NVDSINFER_CUDA_ERROR
Segmentation fault (core dumped)
When I ran the same app but with a different TensorRT engine converted without any plugins being used during the conversion, the app worked fine. So, the issue has to do with the ScatterND
plugin being used in the app. For deepstream app, how can we fix this? I added initLibNvInferPlugins(nullptr, "");
to the app and link nvinfer_plugin
library to the app but the error still occurred.
Steps to reproduce
- run docker
nvcr.io/nvidia/deepstream:6.0-devel
- convert this onnx model to TensorRT using
/usr/src/tensorrt/bin/trtexec --onnx=darknet-53_b1_sim.onnx --workspace=64 --fp16 --saveEngine=darknet-53_b1.engine
- create a simple DeepStream app that uses
nvinfer
plugin and run the engine file.
nvinfer
plugin’s config file
[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-engine-file=../../models/people_reid/darknet-53_b1.engine
# model-engine-file=../../models/people_tracking/bytetrack_s.engine
# custom-lib-path=/usr/lib/x86_64-linux-gnu/libnvinfer_plugin.so
# scaling-filter=1
# batch-size=1
force-implicit-batch-dim=1
model-color-format=0
interval=0
gie-unique-id=1
output-blob-names=output
# 0=Detector, 1=Classifier, 2=Segmentation, 100=Other
network-type=100
# Enable tensor metadata output
output-tensor-meta=1
Environment
Architecture: x86_64
GPU: NVIDIA GeForce GTX 1650 Ti with Max-Q Design
NVIDIA GPU Driver: Driver Version: 495.29.05
DeepStream Version: 6.0 (running on docker image nvcr.io/nvidia/deepstream:6.0-devel)
TensorRT Version: v8001
Issue Type: Question