Difference between revisions of "DeepStream Reference Designs/Getting Started/Environment Setup"

From RidgeRun Developer Connection
Jump to: navigation, search
m
m (System Setup)
 
(68 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
 
<noinclude>
 
<noinclude>
{{DeepStream Reference Designs/Head|next=}}
+
{{DeepStream Reference Designs/Head|previous=Getting Started| next=Getting Started/Evaluating the Project}}
 
</noinclude>
 
</noinclude>
  
This page describes the fundamentals of RidgeRun's DeepStream Reference Designs. After reading this page it should be clear if the product meets your requirements for building your own applications.
+
== System Setup ==
 +
 
 +
We offer several versions of the system, all based on the NVIDIA Jetson boards. Small places that use a single or dual camera may use a Jetson Nano, while big commerce with 32 cameras may need to use the Jetson Xavier AGX.
 +
* RTSP Cameras: 1 to 8 simultaneous cameras.
 +
* Jetson Board: portable through Jetson Orin, Nano, TX2, NX, and AGX development kits.
 +
 
 +
The system is based on [https://developer.nvidia.com/deepstream-sdk NVIDIA's DeepStream SDK] to take advantage of the board's hardware and multimedia capabilities. The DeepStream version used in this project is 6.0, which is included as part of the NVIDIA JetPack 4.6. In case you need to install JetPack SDK 4.6, NVIDIA provides the Image SD Card method or it can also be installed through the NVIDIA SDK Manager. For more information on such installation methods, you can refer to the [https://developer.nvidia.com/embedded/jetpack-sdk-46 '''JETPACK SDK 4.6 RELEASE PAGE''']official NVIDIA documentation.
 +
 
 +
== Dependencies ==
 +
 
 +
This project has the following system dependencies:
 +
* pkg-config
 +
* gtk-doc-tools
 +
* libgstreamer1.0-dev
 +
* libgstreamer-plugins-base1.0-dev
 +
* gstreamer1.0-tools
 +
* gstreamer1.0-plugins-good
 +
* gstreamer1.0-libav
 +
* python3-pip
 +
 
 +
You may install the dependencies with the following command:
 +
<syntaxhighlight lang='bash'>
 +
$ sudo apt-get install -y python3 python3-pip python3-setuptools python3-wheel ninja-build pkg-config gtk-doc-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev  gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-libav libopencv-dev
 +
</syntaxhighlight>
 +
 
 +
== GstD ==
 +
 
 +
To handle the media instances used in this project, we rely on the methods provided by the Python API of [https://developer.ridgerun.com/wiki/index.php/GStreamer_Daemon Gstreamer Daemon (GstD)]. In order to install GStreamer Daemon, we invite you to refer to the following [https://developer.ridgerun.com/wiki/index.php/GStreamer_Daemon_-_Building_GStreamer_Daemon installation guide].
 +
 
 +
== GstInterpipe ==
 +
 
 +
The media descriptors built in this project use the Gstreamer plugin called [https://developer.ridgerun.com/wiki/index.php/GstInterpipe GstInterpipe]. To install this plugin, we invite you to follow the [https://developer.ridgerun.com/wiki/index.php/GstInterpipe_-_Building_and_Installation_Guide building and installation guide].
 +
 
 +
== AMQP Protocol Adapter ==
 +
 
 +
The project has a dependency on using a message broker like RabbitMQ. From DeepStream version 5.0, an AMQP protocol adapter is included that DeepStream applications can use out of the box to publish messages using AMQP 0-9-1 message protocol. The AMQP protocol adapter shared library is in the DeepStream package at:
 +
 
 +
<syntaxhighlight lang="bash">
 +
/opt/nvidia/deepstream/deepstream-6.0/lib/libnvds_amqp_proto.so
 +
</syntaxhighlight>
  
 +
The AMQP protocol adapter also has its own dependencies. To install the additional dependencies, you can run the following command:
  
== Introduction ==
+
<syntaxhighlight lang="bash">
 +
$ sudo apt-get install libglib2.0 libglib2.0-dev libssl-dev
 +
</syntaxhighlight>
  
RidgeRun's DeepStream Reference Designs is a project that provides a robust and modular design, based on the [https://developer.nvidia.com/deepstream-sdk NVIDIA DeepStream SDK], where the building blocks may be replaced to fit a wide variety of use cases. The main objective is to provide an infrastructure for an application using video analytics to perform informed decisions within the application domain. The system could be divided into the following parts:
+
AMQP protocol adapter for DeepStream uses the librabbitmq.so library, built from [https://github.com/alanxz/rabbitmq-c rabbitmq-c] for the underlying AMQP protocol implementation. To build the library, you may enter the following commands:
  
=== Framework ===
+
<syntaxhighlight lang="bash">
 +
$ git clone -b v0.8.0  --recursive https://github.com/alanxz/rabbitmq-c.git
 +
$ cd rabbitmq-c
 +
$ mkdir build && cd build
 +
$ cmake ..
 +
$ cmake --build .
 +
</syntaxhighlight>
  
The framework is the main infrastructure responsible for driving the application state and logic. All modules here do not need modification in order to implement a new application, consequently, this part is the common source that is shared with other applications. There are four principal sections that compose the framework:
+
To copy the built librabbitmq.so library to its final location on the Jetson, enter the following command:
  
* '''Camera Capture''': In charge of keeping the control of media sources (cameras, RTSP streams).
+
<syntaxhighlight lang="bash">
* '''AI Manager''': This module will process DeepStream inference defined by the application and will communicate with the next section.
+
$ sudo cp ./librabbitmq/librabbitmq.so.4 /usr/lib/aarch64-linux-gnu/
* '''Action Dispatcher''': Uses the data of DeepStream inference to do established actions depending on policies. The actions and policies are defined by the application.
+
</syntaxhighlight>
* '''Config Parser''': This module is in charge of loading the configuration files set up to be used by the application.
 
  
=== Application ===
+
The AMQP protocol communicates with an AMQP 0-9-1 compliant message broker like [https://www.rabbitmq.com/ RabbitMQ]. In this project, we use docker to build an image with the RabbitMQ message broker. Docker is one of the packages installed as part of NVIDIA JetPack 4.6, so no extra installation is required. You can check the docker version installed on the Jetson with the following command:
  
We focus on bringing a solution that the users only need to think about what are they looking for and not develop everything right from the start. So in this part, the users can define the camera source, DeepStream model, and policies that do they serve as a filter of DeepStream inference data that allow for implementation decisions and be executed by the actions, which are also user-defined. All the logic and mechanism to execute all that the user uses in the application is provided by the framework.
+
<syntaxhighlight lang="bash">
 +
$ docker --version
 +
Docker version 20.10.2, build 20.10.2-0ubuntu1~18.04.2
 +
</syntaxhighlight>
  
== System Setup ==
+
The first time you run the project, docker will display a message indicating that it could not find the RabbitMQ image locally, however, it will automatically search the remote server to install it correctly.
 +
 
 +
== Nvmsgconv Plugin ==
  
We offer several versions of the system, all based on the NVIDIA Jetson boards. Small places that use a single or dual camera may use a Jetson Nano, while big commerce with 32 cameras may need to use the Jetson Xavier AGX.
+
As part of its components, this project uses the DeepStream plugin called [https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvmsgconv.html Gst-nvmsgconv] to build the payload messages that will be transmitted by the broker. If you want to know more about this module and its role within the system you can review the Wiki section of [https://developer.ridgerun.com/wiki/index.php/DeepStream_Reference_Designs/Reference_Designs/Automatic_Parking_Lot_Vehicle_Registration#Inference_Parser APLVR Inference Parser]. By default, the library required by the DeepStream pipeline to use nvmsgconv is not built. So in a terminal, you should navigate to the following path and run the make command:
* RTSP Cameras: 1 to 8 simultaneous cameras.
 
* Jetson Board: portable through Jetson Nano, TX2, NX, and AGX development kits.
 
  
The system is based on [https://developer.nvidia.com/deepstream-sdk NVIDIA's DeepStream] to take advantage of the board's hardware and multimedia capabilities.
+
<syntaxhighlight lang="bash">
 +
$ cd /opt/nvidia/deepstream/deepstream-6.0/sources/libs/nvmsgconv/ && sudo make
 +
</syntaxhighlight>
  
 +
After that, you can inspect the library generated with the "ls" command, and  the directory should have the following library (among other files):
  
 +
<syntaxhighlight lang="bash">
 +
$ ls
 +
...
 +
libnvds_msgconv.so
 +
...
 +
</syntaxhighlight>
 +
 
<noinclude>
 
<noinclude>
{{DeepStream Reference Designs/Foot||}}
+
{{DeepStream Reference Designs/Foot|Getting Started|Getting Started/Evaluating the Project}}
 
</noinclude>
 
</noinclude>

Latest revision as of 13:14, 3 August 2022



Previous: Getting Started Index Next: Getting Started/Evaluating the Project
Nvidia-preferred-partner-badge-rgb-for-screen.png




System Setup

We offer several versions of the system, all based on the NVIDIA Jetson boards. Small places that use a single or dual camera may use a Jetson Nano, while big commerce with 32 cameras may need to use the Jetson Xavier AGX.

  • RTSP Cameras: 1 to 8 simultaneous cameras.
  • Jetson Board: portable through Jetson Orin, Nano, TX2, NX, and AGX development kits.

The system is based on NVIDIA's DeepStream SDK to take advantage of the board's hardware and multimedia capabilities. The DeepStream version used in this project is 6.0, which is included as part of the NVIDIA JetPack 4.6. In case you need to install JetPack SDK 4.6, NVIDIA provides the Image SD Card method or it can also be installed through the NVIDIA SDK Manager. For more information on such installation methods, you can refer to the JETPACK SDK 4.6 RELEASE PAGEofficial NVIDIA documentation.

Dependencies

This project has the following system dependencies:

  • pkg-config
  • gtk-doc-tools
  • libgstreamer1.0-dev
  • libgstreamer-plugins-base1.0-dev
  • gstreamer1.0-tools
  • gstreamer1.0-plugins-good
  • gstreamer1.0-libav
  • python3-pip

You may install the dependencies with the following command:

$ sudo apt-get install -y python3 python3-pip python3-setuptools python3-wheel ninja-build pkg-config gtk-doc-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev  gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-libav libopencv-dev

GstD

To handle the media instances used in this project, we rely on the methods provided by the Python API of Gstreamer Daemon (GstD). In order to install GStreamer Daemon, we invite you to refer to the following installation guide.

GstInterpipe

The media descriptors built in this project use the Gstreamer plugin called GstInterpipe. To install this plugin, we invite you to follow the building and installation guide.

AMQP Protocol Adapter

The project has a dependency on using a message broker like RabbitMQ. From DeepStream version 5.0, an AMQP protocol adapter is included that DeepStream applications can use out of the box to publish messages using AMQP 0-9-1 message protocol. The AMQP protocol adapter shared library is in the DeepStream package at:

/opt/nvidia/deepstream/deepstream-6.0/lib/libnvds_amqp_proto.so

The AMQP protocol adapter also has its own dependencies. To install the additional dependencies, you can run the following command:

$ sudo apt-get install libglib2.0 libglib2.0-dev libssl-dev

AMQP protocol adapter for DeepStream uses the librabbitmq.so library, built from rabbitmq-c for the underlying AMQP protocol implementation. To build the library, you may enter the following commands:

$ git clone -b v0.8.0  --recursive https://github.com/alanxz/rabbitmq-c.git
$ cd rabbitmq-c
$ mkdir build && cd build
$ cmake ..
$ cmake --build .

To copy the built librabbitmq.so library to its final location on the Jetson, enter the following command:

$ sudo cp ./librabbitmq/librabbitmq.so.4 /usr/lib/aarch64-linux-gnu/

The AMQP protocol communicates with an AMQP 0-9-1 compliant message broker like RabbitMQ. In this project, we use docker to build an image with the RabbitMQ message broker. Docker is one of the packages installed as part of NVIDIA JetPack 4.6, so no extra installation is required. You can check the docker version installed on the Jetson with the following command:

$ docker --version
Docker version 20.10.2, build 20.10.2-0ubuntu1~18.04.2

The first time you run the project, docker will display a message indicating that it could not find the RabbitMQ image locally, however, it will automatically search the remote server to install it correctly.

Nvmsgconv Plugin

As part of its components, this project uses the DeepStream plugin called Gst-nvmsgconv to build the payload messages that will be transmitted by the broker. If you want to know more about this module and its role within the system you can review the Wiki section of APLVR Inference Parser. By default, the library required by the DeepStream pipeline to use nvmsgconv is not built. So in a terminal, you should navigate to the following path and run the make command:

$ cd /opt/nvidia/deepstream/deepstream-6.0/sources/libs/nvmsgconv/ && sudo make

After that, you can inspect the library generated with the "ls" command, and the directory should have the following library (among other files):

$ ls
...
libnvds_msgconv.so
...



Previous: Getting Started Index Next: Getting Started/Evaluating the Project