Getting Started with NVIDIA DeepStream-5.0

Karthick Panner Selvam
Analytics Vidhya
Published in
3 min readMay 6, 2020

After my previous post, I’m getting requests to make article on how to get started with NVIDIA DeepStream.

NVIDIA DeepStream Released 5.0 version with new exciting features support for both DGPU and JETSON devices. You can find more information on NVIDIA DeepStream SDK on https://developer.nvidia.com/deepstream-sdk.

In this article I will be sharing detailed steps on how to install NVIDIA DeepStream on DGPU based devices.

You must install the following components:

Ubuntu 18.04

GStreamer 1.14.1

NVIDIA driver 440+

CUDA 10.2

TensorRT 7.0 or later

1. Remove the previous DeepStream Installation

If it is the first time DeepStream Installation you can skip this section

Uninstall DeepStream 3.0
To uninstall any previously installed DeepStream 3.0 libraries, run the following command.

sudo rm -rf /usr/local/deepstream /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libnvdsgst_* \
/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstnv* \
/usr/bin/deepstream*

Uninstall DeepStream 4.0
To uninstall any previously installed DeepStream 4.0 libraries, use uninstall.sh script.

1. Open the uninstall.sh file which will be present in /opt/nvidia/deepstream/deepstream/
2. Set PREV_DS_VER as 4.0
3. Run the script as sudo ./uninstall.sh

Note that this will run only for DeepStreamSDK versions equal to or above 4.0.

Remove NVIDIA drivers & CUDA
To remove any previously installed NVIDIA drivers and CUDA libraries, to avoid version conflict

sudo apt purge *nvidia*
sudo apt autoremove
sudo apt autoremove --purge 'cuda*'

2. Install Gstreamer packages

Run the following command in your terminal

sudo apt install build-essential gitsudo apt 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

3. Install NVIDIA driver 440+

Add graphics drivers to your source list

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt upgrade

Check what driver will be installed :

ubuntu-drivers devices

Auto install latest driver

sudo ubuntu-drivers autoinstall

Then reboot your machine :

sudo reboot

After boot you can check the correct install of the driver :

lsmod | grep nvidia

4. To install CUDA 10.2+

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pinsudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.debsudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.debsudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pubsudo apt-get updatesudo apt-get -y install cuda

5. To install TensorRT 7.0

Download TensorRT 7.0 from the NVIDIA Developer Center:

https://developer.nvidia.com/nvidia-tensorrt-download

TensorRT 7.0.0.11 for Ubuntu 1804 and CUDA 10.2 DEB local repo packages

cd ~/Downloadssudo dpkg -i ./nv-tensorrt-repo-ubuntu1804-cuda10.2-trt7.0.0.11-ga-20191216_1-1_amd64.debsudo apt-key add /var/nv-tensorrt-repo-cuda10.2-trt7.0.0.11-ga-20191216/7fa2af80.pubsudo apt-get updatesudo apt-get install tensorrtsudo apt-get install uff-converter-tf

Verify the installation.

dpkg -l | grep TensorRT

6. To install librdkafka

enable Kafka protocol adaptor for message broker

Clone the librdkafka repository from GitHub:

git clone https://github.com/edenhill/librdkafka.git

Configure and build the library:

cd librdkafkagit reset --hard 7101c2310341ab3f4675fc565f64f0967e135a6a./configuremakesudo make install

Copy the generated libraries to the deepstream directory:

sudo mkdir -p /opt/nvidia/deepstream/deepstream-5.0/libsudo cp /usr/local/lib/librdkafka* /opt/nvidia/deepstream/deepstream-5.0/lib

7. To install the DeepStream SDK

Download the DeepStream 5.0 dGPU Debian package, deepstream-5.0_5.0.0–1_amd64.deb https://developer.nvidia.com/deepstream-getting-started

then enter the command:

sudo apt-get install ./deepstream-5.0_5.0.0-1_amd64.deb

8. To run the deepstream-app for test

deepstream-app -c /opt/nvidia/deepstream/deepstream-5.0/samples/configs/deepstream-app/source4_1080p_dec_infer-resnet_tracker_sgie_tiled_display_int8.txt

If you encountered following problem when running deepstream-app:

a) Failed to load plugin ‘/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_inferserver.so’: libtrtserver.so

Solution:

Clear the gstreamer cache to view real problems

rm -rf ~/.cache/gstreamer-1.0/

b) Error: Could not get cuda device count

Solution:

Enable all GPU’s

sudo nvidia-xconfig --enable-all-gpus

Thanks for reading.

If you have any suggestions/Questions kindly let us know in the comments section!

--

--

Karthick Panner Selvam
Analytics Vidhya

Computer Scientist, specializing in AI, IoT and Computer Vision.