marcoslucianops / DeepStream-Yolo

NVIDIA DeepStream SDK 7.0 / 6.4 / 6.3 / 6.2 / 6.1.1 / 6.1 / 6.0.1 / 6.0 / 5.1 implementation for YOLO models
MIT License
1.38k stars 343 forks source link

Could not find Custom Engine Creation Function 'NvDsInferYoloCudaEngineGe' #508

Closed flmello closed 4 months ago

flmello commented 5 months ago

I am trying to use the Deepstream-Yolo setup into my .py script, but I get an error complaining that 'NvDsInferYoloCudaEngineGe' was not found.

In order to be sure Yolov5 is running with Deepstream, I made all setups from this repository instructions. Then I successfully managed to run deepstream-app -c ./config/deepstream_app_config.txt. It opens my RTSP stream, does the inference, draw boxes and so on.

Then, I took an working example of python script (see attachment test4.py.txt ) and changed the primary GPU inference engine pgie to the one that was working and being used by my deepstream_app_config.txt. I expected that replacing the pgie config file would be enough, but it is not being able to find NvDsInferYoloCudaEngineGe, although it is there. This is the pgie config file dstest4_pgie_nvinfer_yolov5_config.txt.

And this is the complete log of the error:

ubuntu@ubuntu:~/edge$ python3 test4.py -i rtsp://admin:hbyt12345@10.21.45.19:554

(gst-plugin-scanner:18023): GStreamer-WARNING **: 10:08:55.522: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libcustom2d_preprocess.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libcustom2d_preprocess.so: undefined symbol: NvBufSurfTransformAsync

(gst-plugin-scanner:18023): GStreamer-WARNING **: 10:08:55.597: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_inferserver.so': libtritonserver.so: cannot open shared object file: No such file or directory

(gst-plugin-scanner:18023): GStreamer-WARNING **: 10:08:55.607: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_preprocess.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_preprocess.so: undefined symbol: NvBufSurfTransformAsync

(gst-plugin-scanner:18023): GStreamer-WARNING **: 10:08:55.628: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_udp.so': librivermax.so.0: cannot open shared object file: No such file or directory Creating Pipeline ... Creating stream-muxer Creating stream-demuxer Creating source bin source-bin-00 ( rtsp://admin:hbyt12345@10.21.45.19:554 ) Creating uri-decode-bin Creating primary-gpu-inference-engine PGIE batch size : 1 Creating nvtracker Creating nvtee Creating nvtiler Creating convertor 0 Creating convertor tile Creating onscreendisplay 0 Creating onscreendisplay tile Creating convertor_postosd 0 Creating convertor_postosd tile Creating capsfilter 0 Creating capsfilter tile Creating h264-encoder 0 Creating h264-encoder tile Creating rtp-h264-payload 0 Creating rtp-h264-payload tile Creating udp-sink 0 Creating udp-sink tile Adding elements to Pipeline Linking elements in the Pipeline demux source 0

Launched RTSP Streaming at rtsp://localhost:8554/stream0 Launched RTSP Streaming at rtsp://localhost:8554/tiled

Starting pipeline

Opening in BLOCKING MODE Opening in BLOCKING MODE gstnvtracker: Loading low-level lib at /opt/nvidia/deepstream/deepstream/lib/libnvds_nvmultiobjecttracker.so gstnvtracker: Batch processing is ON gstnvtracker: Past frame output is OFF [NvMultiObjectTracker] Initialized 0:00:01.893440470 18021 0x35e7ee00 INFO nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() [UID = 1]: Trying to create engine from model files ERROR: Could not find Custom Engine Creation Function 'NvDsInferYoloCudaEngineGe' in custom lib 0:00:02.974813129 18021 0x35e7ee00 ERROR nvinfer gstnvinfer.cpp:632:gst_nvinfer_logger: NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::buildModel() [UID = 1]: build engine file failed 0:00:02.974905998 18021 0x35e7ee00 ERROR nvinfer gstnvinfer.cpp:632:gst_nvinfer_logger: NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::generateBackendContext() [UID = 1]: build backend context failed 0:00:02.974935791 18021 0x35e7ee00 ERROR nvinfer gstnvinfer.cpp:632:gst_nvinfer_logger: NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::initialize() [UID = 1]: generate backend failed, check config file settings 0:00:02.974976753 18021 0x35e7ee00 WARN nvinfer gstnvinfer.cpp:841:gst_nvinfer_start: error: Failed to create NvDsInferContext instance 0:00:02.975002226 18021 0x35e7ee00 WARN nvinfer gstnvinfer.cpp:841:gst_nvinfer_start: error: Config file path: /home/ubuntu/edge/config/dstest4_pgie_nvinfer_yolov5_config.txt, NvDsInfer Error: NVDSINFER_CONFIG_FAILED [NvMultiObjectTracker] De-initialized Error: gst-resource-error-quark: Failed to create NvDsInferContext instance (1): /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(841): gst_nvinfer_start (): /GstPipeline:pipeline0/GstNvInfer:primary-gpu-inference-engine: Config file path: /home/ubuntu/edge/config/dstest4_pgie_nvinfer_yolov5_config.txt, NvDsInfer Error: NVDSINFER_CONFIG_FAILED Exiting app

--- 0.007469892501831055 seconds ---

dmichalskii commented 5 months ago

Hi, it looks like you need to need remove comment from model-engine--file line.

flmello commented 5 months ago

Hi, it looks like you need to need remove comment from model-engine--file line.

Model-engine-file overides the definiton of onnx-file. When you remove comment, you are ignoring the .onnx and using the engine file that already exits. When model-engine-file is not provided, a new model file will be compiled based on the onnx-file you set.

But, since my model_b1_gpu0_fp32.engine is the one created with deepstream-app -c ./config/deepstream_app_config.txt with the same config file, I removed the comment, but the error keeps the same.

flmello commented 4 months ago

It seems it was a Typo, there was a missing "t" in 'NvDsInferYoloCudaEngineGe'. The correct is NvDsInferYoloCudaEngineGet