[Solved] Deepstream 4.0 from NGC

Dear all,

My attempt to access Deepstream 4.0 from NGC

$ cd ~/d/Downloads/deepstream
$ wget https://ngc.nvidia.com/downloads/ngccli_reg_linux.zip --no-check-certificate

$ unzip ngccli_reg_linux.zip && chmod u+x ngc
$ md5sum -c ngc.md5
ngc: OK
$ echo "export PATH=\"\$PATH:$(pwd)\"" >> ~/.bash_profile && source ~/.bash_profile
$ ngc config set

$ sudo docker login nvcr.io

$ sudo docker pull nvcr.io/nvidia/deepstream:4.0-19.07

Docker

$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
$ curl -s -L https://nvidia.github.io/.../$distribu.../nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
$ sudo apt-get update
$ sudo apt-get install -y nvidia-container-toolkit
$ sudo systemctl restart docker
$ docker --version
Docker version 18.09.7, build 2d0083d

Login to docker

$ xhost +
access control disabled, clients can connect from any host
$ sudo docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -w /root nvcr.io/nvidia/deepstream:4.0-19.07
root@be03b03efba1:~# cd deepstream_sdk_v4.0_x86_64/
# ls -la

$ cd /opt/nvidia/deepstream/deepstream-4.0/lib

The problem is this libraries, how to copy to my local host computer?

# cd /root/deepstream_sdk_v4.0_x86_64/sources/objectDetector_Yolo
# apt-get install wget
# ./prebuild.sh
# apt-get install \
> libssl1.0.0 \
> libgstreamer1.0-0 \
> gstreamer1.0-tools \
> gstreamer1.0-plugins-good \
> gstreamer1.0-plugins-bad \
> gstreamer1.0-plugins-ugly \
> gstreamer1.0-libav \
> libgstrtspserver-1.0-0 \
> libjansson4
# tar -xvf binaries.tbz2 -C /
# ./install.sh
# ldconfig
# rm ${HOME}/.cache/gstreamer-1.0/registry.aarch64.bin
# cd sources/objectDetector_Yolo

# export CUDADIR=/usr/local/cuda-10.1/
# export LD_LIBRARYPATH=$LD_LIBRARYPATH:/usr/local/cuda-10.1/lib64
# export PATH=$PATH:/usr/local/cuda-10.1/bin

Still Error. How to solve it?

Thank you very much.

Warmest Regards,
Suryadi

Can you paste the error log you met?

Can you run it with ‘–gpus all’ option when you run docker container? Let me know if that fixes the issue.

sudo docker run --gpus all -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -w /root nvcr.io/nvidia/deepstream:4.0-19.07

I think my previous problem now gone, because I use Docker version 19.03.1, build 74b1e89

$ xhost +
$ set export DISPLAY=0.0
$ sudo nvidia-docker run --runtime=nvidia -it -v $HOME/d/learn:/learn -p 8888:8888 -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY -e XAUTHORITY -e NVIDIA_DRIVER_CAPABILITIES=all nvcr.io/nvidia/deepstream:4.0-19.07

I edit ~/.bashrc

export CUDA_HOME="/usr/local/cuda-10.1"
export PATH="/usr/local/cuda-10.1/bin:$PATH"
export LD_PATH_LIBRARY="/usr/local/cuda-10.1/lib64:/usr/local/lib:/opt/nvidia/deepstream/deepstream-4.0/lib"
export LD_LIBRARY_PATH="/usr/local/lib:/usr/local/cuda-10.1/lib64/"
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/cuda-10.1/lib64"
export LD_RUN_PATH="/usr/local/lib"
export GST_PLUGIN_PATH="/usr/lib/x86_64-linux-gnu/gstreamer-1.0/"

# source ~/.bashrc
# cd ~/deepstream_sdk_v4.0_x86_64/sources/apps/sample_apps/deepstream-test1
# make
# deepstream-test1-app ../../../../samples/streams/sample_720p.h264

It works!

Thanks.

What docker version are you using? It’s recommended that you use Docker 19.03 or higher.
https://github.com/NVIDIA/nvidia-docker

Can you find /usr/local/cuda-10.1/include/cuda_runtime_api.h in your platform ?

I followed from github to upgrade my nvidia-docker2

$ sudo nvidia-docker --version
Docker version 19.03.1, build 74b1e89

$ xhost +
$ set export DISPLAY=0.0
$ sudo nvidia-docker run --runtime=nvidia -it -v $HOME/d/learn:/learn -p 8888:8888 -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY -e XAUTHORITY -e NVIDIA_DRIVER_CAPABILITIES=all nvcr.io/nvidia/deepstream:4.0-19.07

# cd /deepstream_sdk_v4.0_x86_64/sources/objectDetector_Yolo
# apt-get install wget
# ./prebuild.sh
# ls -la /usr/local/cuda-10.1/include/cuda_runtime_api.h 
-rw-r--r-- 1 root root 400639 May  6 23:24 /usr/local/cuda-10.1/include/cuda_runtime_api.h
# cd nvdsinfer_custom_impl_Yolo
# export CUDA_VER=10.1
# make

For every gst-plugins, they need to be make and make install

gst-dsexample
gst-nvinfer
gst-nvmsgbroker
gst-nvmsgconv
# cd /root/deepstream_sdk_v4.0_x86_64/sources/gst-plugins/gst-dsexample
# make
# make install

# cd ~/deepstream_sdk_v4.0_x86_64/sources/objectDetector_Yolo
# deepstream-app -c yolov3-tiny.cfg ../../samples/streams/sample_1080p_h264.mp4

How to solve this problem?

Thank you very much in advance.

Warmest Regards,
Suryadi

# cd ~/deepstream_sdk_v4.0_x86_64/sources/apps/sample_apps/deepstream-test3
# make
cc -c -o deepstream_test3_app.o -I../../../includes `pkg-config --cflags gstreamer-1.0` deepstream_test3_app.c
cc -o deepstream-test3-app deepstream_test3_app.o `pkg-config --libs gstreamer-1.0` -L/opt/nvidia/deepstream/deepstream-4.0/lib/ -lnvdsgst_meta -lnvds_meta -lnvdsgst_helper -lm -Wl,-rpath,/opt/nvidia/deepstream/deepstream-4.0/lib/

root@4756ef2e92bf:~/deepstream_sdk_v4.0_x86_64/sources/apps/sample_apps/deepstream-test3# ./deepstream-test3-app ../../../../samples/streams/sample_720p.h264
Now playing: ../../../../samples/streams/sample_720p.h264,
Creating LL OSD context new
0:00:00.282365172   427 0x560fdf6390d0 INFO                 nvinfer gstnvinfer.cpp:519:gst_nvinfer_logger:<primary-nvinference-engine> NvDsInferContext[UID 1]:initialize(): Trying to create engine from model files
0:00:08.965043350   427 0x560fdf6390d0 INFO                 nvinfer gstnvinfer.cpp:519:gst_nvinfer_logger:<primary-nvinference-engine> NvDsInferContext[UID 1]:generateTRTModel(): Storing the serialized cuda engine to file at /root/deepstream_sdk_v4.0_x86_64/samples/models/Primary_Detector/resnet10.caffemodel_b1_int8.engine
Running...
ERROR from element uri-decode-bin: Invalid URI "../../../../samples/streams/sample_720p.h264".
Error details: gsturidecodebin.c(1384): gen_source_element (): /GstPipeline:dstest3-pipeline/GstBin:source-bin-00/GstURIDecodeBin:uri-decode-bin
Returned, stopping playback
Deleting pipeline

How to solve this problem? Thank you.

To run:
./deepstream-test3-app <uri1> [uri2] ... [uriN] e.g. ./deepstream-test3-app file:///home/ubuntu/video1.mp4 file:///home/ubuntu/video2.mp4
$ ./deepstream-test3-app rtsp://127.0.0.1/video1 rtsp://127.0.0.1/video2

Dear Amycao,

I copied sample_1080p_h264.mp4 and sample_cam6.mp4 to deepstream-test3 directory

drwxr-xr-x 1 root root     4096 Sep  7 19:10 .
drwxr-xr-x 1 root root     4096 Jul 19 08:29 ..
-rw-r--r-- 1 root root     2008 Jul 19 08:29 Makefile
-rw-r--r-- 1 root root     3191 Jul 19 08:29 README
-rwxr-xr-x 1 root root    23208 Aug 30 17:03 deepstream-test3-app
-rw-r--r-- 1 root root    16396 Jul 19 08:29 deepstream_test3_app.c
-rw-r--r-- 1 root root    14320 Aug 30 17:03 deepstream_test3_app.o
-rw-r--r-- 1 root root     3257 Jul 19 08:29 dstest3_pgie_config.txt
-rw-r--r-- 1 root root 34952625 Sep  7 19:10 sample_1080p_h264.mp4
-rw-r--r-- 1 root root 24999084 Sep  7 19:10 sample_cam6.mp4

# ./deepstream-test3-app ../../../../sample_1080p_h264.mp4 ../../../../sample_cam6.mp4
WARNING: Overriding infer-config batch-size (1) with number of sources (2)
Now playing: ../../../../sample_1080p_h264.mp4, ../../../../sample_cam6.mp4,
Creating LL OSD context new
0:00:00.276592511  2177 0x5618bca10a00 INFO                 nvinfer gstnvinfer.cpp:519:gst_nvinfer_logger:<primary-nvinference-engine> NvDsInferContext[UID 1]:initialize(): Trying to create engine from model files
0:00:09.479255382  2177 0x5618bca10a00 INFO                 nvinfer gstnvinfer.cpp:519:gst_nvinfer_logger:<primary-nvinference-engine> NvDsInferContext[UID 1]:generateTRTModel(): Storing the serialized cuda engine to file at /root/deepstream_sdk_v4.0_x86_64/samples/models/Primary_Detector/resnet10.caffemodel_b2_int8.engine
Running...
<b>ERROR from element uri-decode-bin: Invalid URI "../../../../sample_1080p_h264.mp4".</b>
Error details: gsturidecodebin.c(1384): gen_source_element (): /GstPipeline:dstest3-pipeline/GstBin:source-bin-00/GstURIDecodeBin:uri-decode-bin
Returned, stopping playback
Deleting pipeline

it gives error.

# ./deepstream-test3-app file://./sample_1080p_h264.mp4 file://./sample_cam6.mp4

it gives error too (see belows)

How to refer sample_1080p_h264.mp4 as correctly?
Thank you very much in advance.

Warmest regards,
suryadi

please try absolute path.

# ./deepstream-test3-app file:///root/deepstream_sdk_v4.0_x86_64/samples/streams/sample_1080p_h264.mp4 file:///root/deepstream_sdk_v4.0_x86_64/samples/streams/sample_1080p_h265.mp4

It works!
Thank you very much Amycao.

I was also facing similar issue and fixed it by giving absolute path. Why does relative path work for deepstream-test1 and not for deepstream-test3?

Hi meet.dave,

Please open a new topic for your issue. Thanks