DeepStream 6.1.1 Is the release with support for Ubuntu 20.04 LTS

 

Microsoft Store에서 "Ubuntu 20.04.5 LTS" 설치

WSL은 기본 설치 경로가 사용자 디렉토리다.

(C:\Users\user\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx)

 

Windows 상에서 네트워크 드라이브 연결

Install DeepStream

https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Quickstart.html

 

Quickstart Guide — DeepStream 6.1.1 Release documentation

Quickstart Guide NVIDIA® DeepStream Software Development Kit (SDK) is an accelerated AI framework to build intelligent video analytics (IVA) pipelines. DeepStream runs on NVIDIA® T4, NVIDIA® Ampere and platforms such as NVIDIA® Jetson AGX Xavier™, NV

docs.nvidia.com

dGPU Setup for Ubuntu

더보기

NOTE:

This document uses the term dGPU (“discrete GPU”) to refer to NVIDIA GPU expansion card products such as NVIDIA Tesla® T4 , NVIDIA GeForce® GTX 1080, NVIDIA GeForce® RTX 2080 and NVIDIA GeForce® RTX 3080. This version of DeepStream SDK runs on specific dGPU products on x86_64 platforms supported by NVIDIA driver 515.65.01 and NVIDIA TensorRT™ 8.4.1.5 and later versions.

 

You must install the following components:

  • GStreamer 1.16.2
  • NVIDIA driver 515.65.01
  • CUDA 11.7 update 1
  • TensorRT 8.4.1.5

Remove all previous DeepStream installations

To remove DeepStream 4.0 or later installations:

  1. Open the uninstall.sh file in /opt/nvidia/deepstream/deepstream/
  2. Set PREV_DS_VER as 4.0
  3. Run the following script as
$ sudo ./uninstall.sh

Install Dependencies

$ sudo apt -y install \
    libssl1.1 \
    libgstreamer1.0-0   \
    libgstreamer1.0-dev \
    gstreamer1.0-tools        \
    gstreamer1.0-plugins-good \
    gstreamer1.0-plugins-bad  \
    gstreamer1.0-plugins-ugly \
    gstreamer1.0-libav        \
    libgstreamer-plugins-base1.0-dev \
    libgstrtspserver-1.0-0   \
    libgstrtspserver-1.0-dev \
    libjansson4 \
    libjson-glib-dev \
    libyaml-cpp-dev \
    gcc \
    make \
    git \
    python3 python-is-python3

 

https://docs.nvidia.com/cuda/archive/11.7.1/wsl-user-guide/index.html

 

CUDA on WSL :: CUDA Toolkit Documentation

Whether to efficiently use hardware resources or to improve productivity, virtualization is a more widely used solution in both consumer and enterprise space. There are different types of virtualizations, and it is beyond the scope of this document to delv

docs.nvidia.com

 

[OS/Linux] - CUDA 11.7.1 on WSL2

 

Install TensorRT 8.4.1.5

$ sudo apt-get -y install \
    libnvinfer8=8.4.1-1+cuda11.6 \
    libnvinfer-plugin8=8.4.1-1+cuda11.6 \
    libnvparsers8=8.4.1-1+cuda11.6 \
    libnvonnxparsers8=8.4.1-1+cuda11.6 \
    libnvinfer-bin=8.4.1-1+cuda11.6 \
    libnvinfer-dev=8.4.1-1+cuda11.6 \
    libnvinfer-plugin-dev=8.4.1-1+cuda11.6 \
    libnvparsers-dev=8.4.1-1+cuda11.6 \
    libnvonnxparsers-dev=8.4.1-1+cuda11.6 \
    libnvinfer-samples=8.4.1-1+cuda11.6 \
    libcudnn8=8.4.1.50-1+cuda11.6 \
    libcudnn8-dev=8.4.1.50-1+cuda11.6 \
    python3-libnvinfer=8.4.1-1+cuda11.6 \
    python3-libnvinfer-dev=8.4.1-1+cuda11.6
더보기

NOTE:

$sudo dpkg -i cudnn-local-repo-ubuntu2004-8.4.1.50_1.0-1_amd64.deb``
$sudo apt-get update
$sudo apt install libcudnn8=8.4.1.50-1+cuda11.6 libcudnn8-dev=8.4.1.50-1+cuda11.6

 

Install librdkafka (to enable Kafka protocol adaptor for message broker)

1. Clone the librdkafka repository from GitHub:

2. Configure and build the library:

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

$ cd librdkafka
$ git reset --hard 7101c2310341ab3f4675fc565f64f0967e135a6a
$ ./configure
$ make
make[1]: Entering directory '/home/ym/dev/librdkafka/src'
...
Generating linker script librdkafka.lds from rdkafka.h
/usr/bin/env: ‘python’: No such file or directory
make[1]: *** [Makefile:79: librdkafka.lds] Error 127
make[1]: Leaving directory '/home/ym/dev/librdkafka/src'
make: *** [Makefile:20: libs] Error 2

$ whereis python3
python3: /usr/bin/python3.8 /usr/bin/python3 /usr/lib/python3.8 /usr/lib/python3.9 /usr/lib/python3 /etc/python3.8 /etc/python3 /usr/local/lib/python3.8 /usr/share/python3 /mnt/c/Users/jylee/AppData/Local/Microsoft/WindowsApps/python3.exe /mnt/c/msys64/mingw64/bin/python3.10-config /mnt/c/msys64/mingw64/bin/python3.exe /usr/share/man/man1/python3.1.gz

#$ sudo ln -s /usr/bin/python3 /usr/bin/python
$ sudo apt install python-is-python3

$ make
make[1]: Entering directory '/home/ym/dev/librdkafka/src'
...
Updating
CONFIGURATION.md CONFIGURATION.md.tmp differ: byte 345, line 6
Checking  integrity
CONFIGURATION.md               OK
examples/rdkafka_example       OK
examples/rdkafka_performance   OK
examples/rdkafka_example_cpp   OK
make[1]: Entering directory '/home/ym/dev/librdkafka/src'
Checking librdkafka integrity
librdkafka.so.1                OK
librdkafka.a                   OK
Symbol visibility              OK
make[1]: Leaving directory '/home/ym/dev/librdkafka/src'
make[1]: Entering directory '/home/ym/dev/librdkafka/src-cpp'
Checking librdkafka++ integrity
librdkafka++.so.1              OK
librdkafka++.a                 OK
make[1]: Leaving directory '/home/ym/dev/librdkafka/src-cpp'

$ sudo make install

If Python3 has been installed, run these commands: whereis python3

Then we create a symlink to it: sudo ln -s /usr/bin/python3 /usr/bin/python

 

3. Copy the generated libraries to the deepstream directory:

$ sudo mkdir -p /opt/nvidia/deepstream/deepstream-6.1/lib
$ sudo cp /usr/local/lib/librdkafka* /opt/nvidia/deepstream/deepstream-6.1/lib

 

Install the DeepStream SDK

Method 1: Using the DeepStream Debian package

Download the DeepStream 6.1.1 dGPU Debian package deepstream-6.1_6.1.1-1_amd64.deb:

https://developer.nvidia.com/deepstream-6.1_6.1.1-1_amd64.deb

$ sudo apt-get install ./deepstream-6.1_6.1.1-1_amd64.deb
...
---------------------------------------------------------------------------------------
NOTE: sources and samples folders will be found in /opt/nvidia/deepstream/deepstream-6.1
---------------------------------------------------------------------------------------
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...

 

Run the deepstream-app (the reference application)

Go to the samples directory and enter this command:

$ deepstream-app -c <path_to_config_file>

 

Run precompiled sample applications

1. Navigate to the chosen application directory inside sources/apps/samples_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

When the application is run for a model which does not have an existing engine file, it may take up to a few minutes (depending on the platform and the model) for the file generation and application launch. For later runs, these generated engine files can be reused for faster loading.

 

'C, C++ > DeepStream' 카테고리의 다른 글

Crop and Resize Objects  (0) 2022.11.08

How does secondary GIE crop and resize objects?

SGIE will crop the object from NvStreamMux buffer using the object’s bbox detected by the Primary GIE.

The crop is then scaled/converted to the network resolution/color format.

For example, if the NvStreamMux resolution is 1920x1080, SGIE will crop using object bbox co-ordinates

(e.g. x=1000, y=20, w=400, y=500) from the 1920x1080 image and then scale it to the SGIE network resolution (say 224x224).

In practice, the object crop + scaling + color conversion happens in one go.

 

How to save frames from GstBuffer?

To save frames from gst buffer you need to Map gst buffer using gst_buffer_map () API.

Here is the pseudo code:

GstMapInfo in_map_info;
NvBufSurface *surface = NULL;

memset(&in_map_info, 0, sizeof(in_map_info));
if (!gst_buffer_map(inbuf, &in_map_info, GST_MAP_READ)) {
    g_print ("Error: Failed to map gst buffer\n");
}
surface = (NvBufSurface*)in_map_info.data;

Now that you have access to NvBufSurface structure, you can access actual frame memory and save it.

At the end you need to unmap gst buffer using gst_buffer_unmap (inbuf, &in_map_info)

For more details, see gst_dsexample_transform_ip() in gst-dsexample plugin source code.

 

 

 

 

 

'C, C++ > DeepStream' 카테고리의 다른 글

Install DeepStream 6.1.1 on WSL2  (0) 2022.11.08

+ Recent posts