Deepstreem installation fails

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson Orin
• DeepStream Version Latest
• JetPack Version (valid for Jetson only) Latest
• TensorRT Version Latest
**• NVIDIA GPU Driver Version (valid for GPU only)**Latest
• Issue Type( questions, new requirements, bugs)
The installation of Deepstream on my Orin work according to the SDK Manager.
When trying to run the test sample for USB input I get Pyds import error. So after reading about that (which is not stated in the prerequisites) I found the setup.py to install it. Still not working.
Before I loose my nerve and ranting too much. I would love some support on this matter.

Tried: pip install pyds
equirement already satisfied: pyds in /usr/local/lib/python3.8/dist-packages/pyds-1.1.4-py3.8.egg (1.1.4)
Requirement already satisfied: PyGObject in /usr/lib/python3/dist-packages (from pyds) (3.36.0)
Requirement already satisfied: pgi in /usr/local/lib/python3.8/dist-packages/pgi-0.0.11.2-py3.8.egg (from pyds) (0.0.11.2)
Requirement already satisfied: pycairo>=1.11.1 in /usr/lib/python3/dist-packages (from PyGObject->pyds) (1.16.2)

Are you running deepstream_python_apps from git hub? Please be sure python binding is installed on bindings pages.

I tried that yes. Following the instruction on deepstream home-page on using python bindings.
I will start with following the bindings instructions provided,

Thanks for quick response.

Will install correct packages for 20.04

~/projects/deepstream_python_apps/bindings/build$ make
Scanning dependencies of target pyds
[ 6%] Building CXX object CMakeFiles/pyds.dir/src/pyds.cpp.o
In file included from /home/aiadmin/projects/deepstream_python_apps/bindings/…/3rdparty/pybind11/include/pybind11/pytypes.h:12,
from /home/aiadmin/projects/deepstream_python_apps/bindings/…/3rdparty/pybind11/include/pybind11/cast.h:13,
from /home/aiadmin/projects/deepstream_python_apps/bindings/…/3rdparty/pybind11/include/pybind11/attr.h:13,
from /home/aiadmin/projects/deepstream_python_apps/bindings/…/3rdparty/pybind11/include/pybind11/pybind11.h:44,
from /home/aiadmin/projects/deepstream_python_apps/bindings/include/bind/bind_string_property_definitions.h:18,
from /home/aiadmin/projects/deepstream_python_apps/bindings/include/bind/bindanalyticsmeta.hpp:20,
from /home/aiadmin/projects/deepstream_python_apps/bindings/src/pyds.cpp:19:
/home/aiadmin/projects/deepstream_python_apps/bindings/…/3rdparty/pybind11/include/pybind11/detail/common.h:112:10: fatal error: Python.h: No such file or directory
112 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/pyds.dir/build.make:63: CMakeFiles/pyds.dir/src/pyds.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/pyds.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

Changed to correct version of Linux for building and
then I get

n file included from /home/aiadmin/projects/deepstream_python_apps/bindings/include/pyds.hpp:34,
                 from /home/aiadmin/projects/deepstream_python_apps/bindings/include/bind/bindanalyticsmeta.hpp:23,
                 from /home/aiadmin/projects/deepstream_python_apps/bindings/src/pyds.cpp:19:
/opt/nvidia/deepstream/deepstream-6.1/sources/includes/nvdsinfer.h:287:28: warning: missing initializer for member ‘NvDsInferDims::d’ [-Wmissing-field-initializers]
  287 |     NvDsInferDims dims = {0};
      |                            ^
/opt/nvidia/deepstream/deepstream-6.1/sources/includes/nvdsinfer.h:287:28: warning: missing initializer for member ‘NvDsInferDims::numElements’ [-Wmissing-field-initializers]

I managed to run the sample by copying the pyds.so to the test folder.
The global path settings does not make it work.

But now I get more errors.

Using winsys: x11 0:00:01.606777690 16758 0x5ddca70 WARN nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::initialize() <nvdsinfer_context_impl.cpp:1170> [UID = 1]: Warning, OpenCV has been deprecated. Using NMS for clustering instead of cv::groupRectangles with topK = 20 and NMS Threshold = 0.5 WARNING: Deserialize engine failed because file path: /home/aiadmin/projects/deepstream_python_apps/apps/deepstream-test1-usbcam/../../../../samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine open error 0:00:07.058246312 16758 0x5ddca70 WARN nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1897> [UID = 1]: deserialize engine from file :/home/aiadmin/projects/deepstream_python_apps/apps/deepstream-test1-usbcam/../../../../samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed 0:00:07.225513310 16758 0x5ddca70 WARN nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2002> [UID = 1]: deserialize backend context from engine from file :/home/aiadmin/projects/deepstream_python_apps/apps/deepstream-test1-usbcam/../../../../samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed, try rebuild 0:00:07.225569407 16758 0x5ddca70 INFO nvinfer gstnvinfer.cpp:646:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1923> [UID = 1]: Trying to create engine from model files WARNING: [TRT]: The implicit batch dimension mode has been deprecated. Please create the network with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag whenever possible. ERROR: Cannot access prototxt file '/home/aiadmin/projects/deepstream_python_apps/apps/deepstream-test1-usbcam/../../../../samples/models/Primary_Detector/resnet10.prototxt' ERROR: failed to build network since parsing model errors. ERROR: failed to build network. 0:00:10.205343176 16758 0x5ddca70 ERROR nvinfer gstnvinfer.cpp:640:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1943> [UID = 1]: build engine file failed 0:00:10.375738099 16758 0x5ddca70 ERROR nvinfer gstnvinfer.cpp:640:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2029> [UID = 1]: build backend context failed 0:00:10.376280182 16758 0x5ddca70 ERROR nvinfer gstnvinfer.cpp:640:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::initialize() <nvdsinfer_context_impl.cpp:1266> [UID = 1]: generate backend failed, check config file settings 0:00:10.376327383 16758 0x5ddca70 WARN nvinfer gstnvinfer.cpp:846:gst_nvinfer_start:<primary-inference> error: Failed to create NvDsInferContext instance 0:00:10.376342199 16758 0x5ddca70 WARN nvinfer gstnvinfer.cpp:846:gst_nvinfer_start:<primary-inference> error: Config file path: dstest1_pgie_config.txt, NvDsInfer Error: NVDSINFER_CONFIG_FAILED 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(846): gst_nvinfer_start (): /GstPipeline:pipeline0/GstNvInfer:primary-inference: Config file path: dstest1_pgie_config.txt, NvDsInfer Error: NVDSINFER_CONFIG_FAILED

No need to copy pyds.so, please install the wheel: pip3 install ./pyds-1.1.4-py3-none*.whl

I did and it
Tried: pip install pyds
equirement already satisfied: pyds in /usr/local/lib/python3.8/dist-packages/pyds-1.1.4-py3.8.egg (1.1.4)
Requirement already satisfied: PyGObject in /usr/lib/python3/dist-packages (from pyds) (3.36.0)
Requirement already satisfied: pgi in /usr/local/lib/python3.8/dist-packages/pgi-0.0.11.2-py3.8.egg (from pyds) (0.0.11.2)
Requirement already satisfied: pycairo>=1.11.1 in /usr/lib/python3/dist-packages (from PyGObject->pyds) (1.16.2)

I still need to copy pyds.so

I also found that I do not have the sample models used by the deepstream_python_apps.
The conf file refers to …/…/…/…/samples/models/Primary_Detector/
That folder does not exist. There are no Samples 4 folders down from the Apps example folder.

It’s under /opt/nvidia/deepstream/deepstream/samples/models/

aahhh. I will update the config file to get that

python3 deepstream_test_1.py https://d2qguwbxlx1sbt.cloudfront.net/TextInMotion-VideoSample-1080p.mp4
Creating Pipeline 
 
Creating Source 
 
Creating H264Parser 

Creating Decoder 

Creating EGLSink 

Playing file https://d2qguwbxlx1sbt.cloudfront.net/TextInMotion-VideoSample-1080p.mp4 
Adding elements to Pipeline 

Linking elements in the Pipeline 

Starting pipeline 


Using winsys: x11 
Opening in BLOCKING MODE 
0:00:00.204538220 19464     0x291dfaf0 WARN                 nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::initialize() <nvdsinfer_context_impl.cpp:1170> [UID = 1]: Warning, OpenCV has been deprecated. Using NMS for clustering instead of cv::groupRectangles with topK = 20 and NMS Threshold = 0.5
WARNING: Deserialize engine failed because file path: /opt/nvidia/deepstream/deepstream-6.1/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine open error
0:00:02.821862919 19464     0x291dfaf0 WARN                 nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1897> [UID = 1]: deserialize engine from file :/opt/nvidia/deepstream/deepstream-6.1/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed
0:00:02.979186025 19464     0x291dfaf0 WARN                 nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2002> [UID = 1]: deserialize backend context from engine from file :/opt/nvidia/deepstream/deepstream-6.1/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed, try rebuild
0:00:02.979925166 19464     0x291dfaf0 INFO                 nvinfer gstnvinfer.cpp:646:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1923> [UID = 1]: Trying to create engine from model files
WARNING: [TRT]: The implicit batch dimension mode has been deprecated. Please create the network with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag whenever possible.
WARNING: Serialize engine failed because of file path: /opt/nvidia/deepstream/deepstream-6.1/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine opened error
0:00:58.783276720 19464     0x291dfaf0 WARN                 nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1950> [UID = 1]: failed to serialize cude engine to file: /opt/nvidia/deepstream/deepstream-6.1/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
INFO: [Implicit Engine Info]: layers num: 3
0   INPUT  kFLOAT input_1         3x368x640       
1   OUTPUT kFLOAT conv2d_bbox     16x23x40        
2   OUTPUT kFLOAT conv2d_cov/Sigmoid 4x23x40         

0:00:58.983980132 19464     0x291dfaf0 INFO                 nvinfer gstnvinfer_impl.cpp:328:notifyLoadModelStatus:<primary-inference> [UID 1]: Load new model:dstest1_pgie_config.txt sucessfully
Error: gst-resource-error-quark: Resource not found. (3): gstfilesrc.c(532): gst_file_src_start (): /GstPipeline:pipeline0/GstFileSrc:file-source:
No such file "https://d2qguwbxlx1sbt.cloudfront.net/TextInMotion-VideoSample-1080p.mp4"

So.

I think the error was the video format. It was not h264.
I changed to my USB camera and adjusted width/height and I got it to work.

What would be next step and if you have any support-pages I would like to get
it working on my own Resnet50 model and also a YoloV5 and include FPS count so that I can
evaluate the AI performance and compare to accuracy.

There no python script for yolov5 post processing, if you need python version.
You can refer to GitHub - NVIDIA-AI-IOT/deepstream_tao_apps: Sample apps to demonstrate how to deploy models trained with TAO on DeepStream which support yolov5 model.
you can try deepstream-app for your resnet50 model.

Hi,
Thanks for replying. I will try to get the deepstream work with resnet50. Its the model we use anyways.
so for Orin I will try it. Not working on Jetson as the speed will be too slow.

That means i will have to rule out Deepstream on Jetson.

Is there an example of description on how to modify the resnet10 sample to work with resnet50 for object detection? Some pointers on how to get that to work?

There is no update from you for a period, assuming this is not an issue anymore.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

You can start from here,
https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_using_custom_model.html

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.