NVIDIA Tegra
NVIDIA DeepStream SDK

Development Guide
4.0.1 Release


 
Quick Start Guide
 
Jetson Setup
dGPU Setup
Configuration File Usage Guidelines
Expected Output for the DeepStream Reference Application (deepstream-app)
Package Contents
NVIDIA® DeepStream Software Development Kit (SDK) provides a framework for constructing GPU-accelerated video analytics applications running on the NVIDIA® Tesla®, NVIDIA® Jetson™ Nano, NVIDIA® Jetson AGX Xavier™, and NVIDIA® Jetson™ TX2 platforms.
Jetson Setup
This section explains how to prepare a Jetson device before installing the DeepStream SDK.
To install Jetson SDK components
Download NVIDIA SDK Manager, which you will use to install JetPack 4.2.2 (corresponding to L4T 32.2.1 release) from:
https://developer.nvidia.com/embedded/jetpack
NVIDIA SDK Manager is a graphical application which flashes and installs the JetPack packages.
The flashing procedure takes approximately 10-30 minutes, depending on the host system.
To install additional packages
Enter the following command to install the prerequisite packages for installing the DeepStream SDK:
$ sudo 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=2.11-1
To install librdkafka
Install librdkafka by running apt-get on the Jetson device:
$ apt-get install librdkafka1=0.11.3-1build1
To install the DeepStream SDK
Method 1: Using SDK Manager
SDK Manager installs DeepStream SDK as part of the Jetson SDK Components.
Method 2: Using the DeepStream tar package
1. Download the DeepStream 4.0.1 Jetson tar package, deepstream_sdk_v4.0.1_jetson.tbz2, to the Jetson device.
2. Enter this command to extract the package contents:
$ tar -xpvf deepstream_sdk_v4.0.1_jetson.tbz2
3. Enter these commands to extract and install DeepStream SDK:
$ cd deepstream_sdk_v4.0.1_jetson
$ sudo tar -xvpf binaries.tbz2 -C /
$ sudo ./install.sh
$ sudo ldconfig
Method 3: Using the DeepStream Debian package
Download the DeepStream 4.0.1 Jetson Debian package, deepstream-4.0_4.0.1-1_arm64.deb, to the Jetson device. Then enter the command:
$ sudo apt-get install ./deepstream-4.0_4.0.1-1_arm64.deb
Note:
If you install the DeepStream SDK Debian package using the dpkg command, you must install these packages first, then install the DeepStream deb package:
libgstrtspserver-1.0-0
libgstreamer-plugins-base1.0-dev
To boost the clocks
After you have installed DeepStream SDK, run these commands on the Jetson device to boost the clocks:
$ sudo nvpmodel -m 0
$ sudo jetson_clocks
 
To run deepstream-app (the reference application)
1. Navigate to the samples directory on the development kit.
2. Enter this command to run the reference application:
$ deepstream-app -c <path_to_config_file>
Where <path_to_config_file> is the pathname of one of the reference application’s configuration files, found in configs/deepstream-app/. See Package Contents for a list of the available files.
Note:
For deb installation, you can find sample configuration files under /opt/nvidia/deepstream/deepstream-4.0/samples directory.
Enter this command to see application usage:
$ deepstream-app --help
To show labels in 2D Tiled display view you can expand the source of interest with mouse left-click the source. To return to the tiled display, right-click anywhere in the window.
Keyboard selection of source is also supported. On the console where application is running, press the ‘z’ key followed by the desired row index (0 to 9), then the column index (0 to 9) to expand the source. To restore 2D Tiled display view, press ‘z’ again.
To run precompiled sample applications
1. Navigate to the to the chosen application directory inside sources/apps/sample_apps.
2. Follow the directory’s README file to run the application.
Note:
If the application encounters errors and cannot create Gst elements, remove the GStreamer cache, then try again. To remove the GStreamer cache, enter this command:
$ rm ${HOME}/.cache/gstreamer-1.0/registry.aarch64.bin
dGPU Setup
This section explains how to prepare an Ubuntu x86_64 system with NVIDIA dGPU devices before installing the DeepStream SDK.
Note:
This document uses the term dGPU (“discrete GPU”) to refer to NVIDIA GPU expansion card products such as NVIDIA® Tesla® T4 and P4, NVIDIA® GeForce® GTX 1080, and NVIDIA® GeForce® RTX 2080.
This version of DeepStream SDK runs on specific dGPU products on x86_64 platforms supported by NVIDIA driver 418+ and NVIDIA® TensorRT™ 5.1 and later versions.
You must install the following components:
Ubuntu 18.04
Gstreamer 1.14.1
NVIDIA driver 418+
CUDA 10.1
TensorRT 5.1.5
To remove a previous DeepStream installation
To remove a previous DeepStream installation, enter the command:
$ sudo rm -rf /usr/local/deepstream /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstnv* /usr/bin/deepstream* /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libnvdsgst
$ /usr/lib/x86_64-linux-gnu/libv41/plugins/libcuvidv4l2_plugin.so
To install packages
Enter the following command to install the necessary packages before installing the DeepStream SDK:
$ sudo 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
To install CUDA Toolkit 10.1
Download and install CUDA Toolkit 10.1 from NVIDIA Developer at:
https://developer.nvidia.com/cuda-downloads
To install TensorRT 5.1.5
Download and install TensorRT 5.1.5 from the NVIDIA Developer Center:
https://developer.nvidia.com/nvidia-tensorrt-download
To install librdkafka (to enable Kafka protocol adaptor for message broker)
1. Clone the librdkafka repository from GitHub:
$ git clone https://github.com/edenhill/librdkafka.git
2. Configure and build the library:
$ cd librdkafka
$ git reset --hard 7101c2310341ab3f4675fc565f64f0967e135a6a
./configure
$ make
$ sudo make install
3. Copy the generated libraries to the deepstream directory:
$ sudo mkdir -p /opt/nvidia/deepstream/deepstream-4.0/lib
$ sudo cp /usr/local/lib/librdkafka* /opt/nvidia/deepstream/deepstream-4.0/lib
To install the DeepStream SDK
Method 1: Using the DeepStream Debian package
Download the DeepStream 4.0.1 dGPU Debian package, deepstream-4.0_4.0.1-1_amd64.deb, then enter the command:
$ sudo apt-get install ./deepstream-4.0_4.0.1-1_amd64.deb
Note:
If you install the DeepStream SDK Debian package using the dpkg command, you must install these packages first, then install the DeepStream deb package:
libgstrtspserver-1.0-0
libgstreamer-plugins-base1.0-dev
Method 2: Using the DeepStream tar package
1. Navigate to the location to which the DeepStream package was downloaded and extract its contents:
$ tar -xpvf deepstream_sdk_v4.0.1_x86_64.tbz2
2. Extract and install DeepStream SDK:
$ cd deepstream_sdk_v4.0.1_x86_64
$ sudo tar -xvpf binaries.tbz2 -C /
$ sudo ./install.sh
$ sudo ldconfig
To run the deepstream-app (the reference application)
Go to the samples directory and enter this command:
$ deepstream-app -c <path_to_config_file>
Where <path_to_config_file> is the pathname of one of the reference application’s configuration files, found in configs/deepstream-app. See Package Contents for a list of the available files.
Note:
If you installed using the DeepStream Debian package, you can find sample configuration files under /opt/nvidia/deepstream/deepstream-4.0/samples directory.
Enter this command to see application usage:
$ deepstream-app --help
To show labels in 2D Tiled display view, expand the source of interest with a mouse left-click on the source. To return to the tiled display, right-click anywhere in the window.
Keyboard selection of source is also supported. On the console where application is running, press the ‘z’ key followed by the desired row index (0 to 9), then the column index (0 to 9) to expand the source. To restore the 2D Tiled display view, press ‘z’ again.
To run precompiled sample applications
1. Navigate to the to the chosen application directory inside sources/apps/sample_apps.
2. Follow that directory’s README file to run the application.
Note:
If the application encounters errors and cannot create Gst elements, remove the GStreamer cache, then try again. To remove the GStreamer cache, enter this command:
$ rm ${HOME}/.cache/gstreamer-1.0/registry.x86_64.bin
Configuration File Usage Guidelines
Number of streams your platform can process is dependent on its capability. See Package Contents to find a suitable configuration file for your platform.
Expected Output for the DeepStream Reference Application (deepstream-app)
The image below shows the expected output:
Package Contents
 
Plugin and Library Source Details
Reference Application Source Details
The DeepStream SDK package includes the following archives. These archives contain plugins, libraries, applications and source code.
The sources directory is located at /opt/nvidia/deepstream/deepstream-4.0/sources for Debian installation (on Jetson or dGPU) and for installation by SDK Manager. For tar packages the source files are located in the extracted deepstream package.
Plugin and Library Source Details
The following table describes the contents of the sources directory except for the reference test applications, which are listed separately below.
Plugin or library
Path inside
sources directory
Description
DsExample GStreamer plugin
gst-plugins/gst-dsexample
Template plugin for integrating custom algorithms into DeepStream SDK graph.
GStreamer Gst-nvmsgconv plugin
gst-plugins/gst-nvmsgconv
Source code for the GStreamer Gst-nvmsgconv plugin for converting metadata to schema format.
GStreamer Gst-nvmsgbroker plugin
gst-plugins/gst-nvmsgbroker
Source code for the GStreamer Gst-nvmsgbroker plugin for sending data to the server.
GStreamer Gst-nvinfer plugin
gst-plugins/gst-nvinfer
Source code for the GStreamer Gst-nvinfer plugin for inference.
NvDsInfer library
libs/nvdsinfer
Source code for the NvDsInfer library, used by the Gst-nvinfer GStreamer plugin.
NvMsgConv library
libs/nvmsgsconv
Source code for the NvMsgConv library, required by the Gst-nvmsgconv GStreamer plugin.
Kafka protocol adapter
libs/kafka_protocol_adapter
Protocol adapter for Kafka.
nvdsinfer_customparser
libs/nvdsinfer_customparser
Custom model output parsing example for detectors and classifiers.
Gst-v4l2
See the note below *
Source code for v4l2 codecs.
* Gst-v4l2 sources are not present in DeepStream package. To download, follow these steps:
2. In the “Search filter” field, enter “L4T sources.”
3. Select the appropriate item for L4T Release 32.2.1.
4. Download the file and untar it, yielding a .tbz2 file.
5. Expand the .tbz2 file. Gst-v4l2 source files are in gst-nvvideo4linux2_src.tbz2.
Reference Application Source Details
The following table shows the location of the simple teset applications.
Reference
test application
Path inside
sources directory
Description
Simple test application 1
apps/sample_apps/deepstream-test1
Simple example of how to use DeepStream elements for a single H.264 stream: filesrc → decode → nvstreammux → nvinfer (primary detector) → nvosd → renderer.
Simple test application 2
apps/sample_apps/deepstream-test2
Simple example of how to use DeepStream elements for a single H.264 stream: filesrc → decode → nvstreammux → nvinfer (primary detector) → nvtracker → nvinfer (secondary classifier) → nvosd → renderer.
Simple test application 3
apps/sample_apps/deepstream-test3
Builds on deepstream-test1 (simple test application 1) to demonstrate how to:
Use multiple sources in the pipeline
Use a uridecodebin to accept any type of input (e.g. RTSP/File), any GStreamer supported container format, and any codec
Configure Gst-nvstreammux to generate a batch of frames and infer on it for better resource utilization
Extract the stream metadata, which contains useful information about the frames in the batched buffer
Simple test application 4
apps/sample_apps/deepstream-test4
Builds on deepstream-test1 for a single H.264 stream: filesrc, decode, nvstreammux, nvinfer, nvosd, renderer to demonstrate how to:
Use the Gst-nvmsgconv and Gst-nvmsgbroker plugins in the pipeline
Create NVDS_META_EVENT_MSG type metadata and attach it to the buffer
Use NVDS_META_EVENT_MSG for different types of objects, e.g. vehicle and person
Implement “copy” and “free” functions for use if metadata is extended through the extMsg field
Simple test application 5
apps/sample_apps/deepstream-test5
Builds on top of deepstream-app. Demonstrates:
Use of Gst-nvmsgconv and Gst-nvmsgbroker plugins in the pipeline for multistream
How to configure Gst-nvmsgbroker plugin from the config file as a sink plugin (for KAFKA, Azure, etc.)
How to handle the RTCP sender reports from RTSP servers or cameras and translate the Gst Buffer PTS to a UTC timestamp.
For more details refer the RTCP Sender Report callback function test5_rtcp_sender_report_callback() registration and usage in deepstream_test5_app_main.c.
GStreamer callback registration with rtpmanager element’s “handle-sync” signal is documented in apps-common/src/deepstream_source_bin.c.
AMQP protocol test application
libs/amqp_protocol_adaptor
Test application for AMQP.
Azure MQTT test application
libs/azure_protocol_adaptor
Test application for Azure MQTT.
DeepStream reference application
apps/sample_apps/deepstream-app
Source code for the DeepStream reference application.
UFF SSD detector
sources/objectDetector_SSD
Configuration files and custom library implementation for the SSD detector model.
Faster RCNN detector
sources/objectDetector_FasterRCNN
Configuration files and custom library implementation for the FasterRCNN model.
Yolo detector
sources/objectDetector_Yolo
Configuration files and custom library implementation for the Yolo models, currently Yolo v2, v2 tiny, v3, and v3 tiny.
Dewarper example
apps/sample_apps/deepstream-dewarper-test
Demonstrates dewarper functionality for single or multiple 360 degree camera streams. Reads camera calibration parameters from a CSV file and renders aisle and spot surfaces on the display.
Optical flow example
apps/sample_apps/deepstream-nvof-test
Demonstrates optical flow functionality for single or multiple streams. This example uses two GStreamer plugins (Gst-nvof and Gst-nvofvisual). The Gst-nvof element generates the MV (motion vector) data and attaches it as user metadata. The Gst-nvofvisual element visualizes the MV data using a predefined color wheel matrix.
Custom meta data example
apps/sample_apps/deepstream-user-metadata-test
Demonstrates how to add custom or user-specfic metadata to any component of DeepStream. The test code attaches a 16-byte array filled with user data to the chosen component. The data is retrieved in another component.
MJPEG and JPEG decoder and inferencing example
apps/sample_apps/deepstream-image-decode-test
Builds on deepstream-test3 to demonstrate image decoding instead of video. This example uses a custom decode bin so the MJPEG codec can be used as input.
Image/Video segmentation example
apps/sample_apps/deepstream-segmentation-test
Demonstrates segmentation of multi-stream video or images using a semantic or industrial neural network, and rendering output to a display.
Handling metadata before Gst-nvstreammux
apps/sample_apps/deepstream-gst-metadata-test
Demonstrates how to set metadata before the Gst-nvstreammux plugin in the DeepStream pipeline, and how to access it after Gst-nvstreammux.
Gst-nvinfer tensor meta flow example
apps/sample_apps/deepstream-infer-tensor-meta-app
Demonstrates how to flow and access nvinfer tensor output as metadata.
Performance demo
apps/sample_apps/deepstream-perf-demo
Performs single channel cascaded inferencing and object tracking sequentially on all streams in a directory.
This outline describes the contents of the package:
samples: Directory containing sample configuration files, streams, and models to run the sample applications.
samples/configs: Configuration files for the reference application:
source30_1080p_resnet_dec_infer_tiled_display_int8.txt: Demonstrates 30 stream decodes with primary inferencing. (For dGPU and Jetson AGX Xavier platforms only.)
source4_1080p_resnet_dec_infer_tiled_display_int8.txt: Demonstrates four stream decodes with primary inferencing, object tracking, and three different secondary classifiers. (For dGPU and Jetson AGX Xavier platforms only.)
source4_1080p_resnet_dec_infer_tracker_sgie_tiled_display_int8_gpu1.txt: Demonstrates four stream decodes with primary inferencing, object tracking, and three different secondary classifiers on GPU 1 (for systems that have multiple GPU cards). For dGPU platforms only.
config_infer_primary.txt: Configures an nvinfer element as primary detector.
config_infer_secondary_carcolor.txt, config_infer_secondary_carmake.txt, config_infer_secondary_vehicletypes.txt: Configure an nvinfer element as secondary classifier.
iou_config.txt: Configures a low-level IOU (Intersection over Union) tracker.
source1_usb_dec_infer_resnet_int8.txt: Demonstrates one USB camera as input.
source1_csi_dec_infer_resnet_int8.txt: Demonstrates one CSI camera as input; for Jetson only.
source2_csi_usb_dec_infer_resnet_int8.txt: Demonstrates one CSI camera and one USB camera as inputs; for Jetson only.
source6_csi_dec_infer_resnet_int8.txt: Demonstrates six CSI cameras as inputs; for Jetson only.
source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt: Demonstrates 8 Decode + Infer + Tracker; for Jetson Nano only.
source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_tx1.txt: Demonstrates 8 Decode + Infer + Tracker; for Jetson TX1 only.
source12_1080p_dec_infer-resnet_tracker_tiled_display_fp16_tx2.txt: Demonstrates 12 Decode + Infer + Tracker; for Jetson TX2 only.
samples: Directory containing sample configuration files, models, and streams to run the sample applications.
samples/streams: The following streams are provided with the DeepStream SDK:
Stream
Type of Stream
sample_1080p_h264.mp4
H264 containerized stream
sample_1080p_h265.mp4
H265 containerized stream
sample_720p.h264
H264 elementary stream
sample_720p.jpg
JPEG image
sample_720p.mjpeg
MJPEG stream
sample_cam6.mp4
H264 containerized stream (360D camera stream)
sample_industrial.jpg
JPEG image
samples/models: The following sample models are provided with the SDK:
DeepStream Reference Application
Model
Model Type
Number of Classes
Resolution
Primary Detector
Resnet10
4
640 × 368
Secondary Car Color Classifier
Resnet18
12
224 × 224
Secondary Car Make Classifier
Resnet18
6
224 × 224
Secondary Vehicle Type Classifier
Resnet18
20
224 × 224
 
Segmentation example
Model
Model Type
Number of Classes
Resolution
Industrial
Resnet18 + UNet
1
512 x 512
Semantic
Resnet18 + UNet
4
512 x 512