Skip to content

Commit 175d711

Browse files
committed
Update to 1.1.3 release
This release is compatible with DeepStream SDK 6.1 Ubuntu 20.04 Python 3.8 DeepStream SDK 6.1 Features: - New binding for gst_nvevent_new_stream_reset() - Bug fix in bindings for get_nvds_buf_surface() - Enhanced bindings README
1 parent daae761 commit 175d711

File tree

11 files changed

+177
-73
lines changed

11 files changed

+177
-73
lines changed

HOWTO.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ If missing, install with the following steps:
3535
$ sudo make install
3636
```
3737

38-
<a name="compile_bindings"></a>
39-
## Compiling Python Bindings
38+
<a name="bindings_usage"></a>
39+
## Python Bindings Usage
4040

41-
Please follow instructions for compiling the bindings [here](bindings/README.md)
41+
The prebuilt DeepStreamSDK python bindings for both x86 and Jetson are already available on the [release section](../../releases).
42+
The readme [here](bindings/README.md) provides instructions to customize the bindings or recompile them, if you need to.
4243

4344
Note: Compiling bindings now also generates a pip installable python wheel for the platform (x86 or aarch64) it is compiled on.
4445

apps/deepstream-preprocess-test/README

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,25 @@ Prerequisites:
1919
- DeepStreamSDK 6.1
2020
- Python 3.8
2121
- Gst-python
22+
- GstRtspServer
23+
24+
Installing GstRtspServer and introspection typelib
25+
===================================================
26+
$ sudo apt update
27+
$ sudo apt install python3-gi python3-dev python3-gst-1.0 -y
28+
$ sudo apt-get install libgstrtspserver-1.0-0 gstreamer1.0-rtsp
29+
For gst-rtsp-server (and other GStreamer stuff) to be accessible in
30+
Python through gi.require_version(), it needs to be built with
31+
gobject-introspection enabled (libgstrtspserver-1.0-0 is already).
32+
Yet, we need to install the introspection typelib package:
33+
$ sudo apt-get install libgirepository1.0-dev
34+
$ sudo apt-get install gobject-introspection gir1.2-gst-rtsp-server-1.0
2235

2336
To run:
24-
$ python3 deepstream_preprocess-test.py -i <uri1> [uri2] ... [uriN]
37+
$ python3 deepstream_preprocess_test.py -i <uri1> [uri2] ... [uriN] [-c {H264,H265}] [-b BITRATE]
2538
e.g.
26-
$ python3 deepstream_preprocess-test.py -i file:///home/ubuntu/video1.mp4 file:///home/ubuntu/video2.mp4
27-
$ python3 deepstream_preprocess-test.py -i rtsp://127.0.0.1/video1 rtsp://127.0.0.1/video2
39+
$ python3 deepstream_preprocess_test.py -i file:///home/ubuntu/video1.mp4 file:///home/ubuntu/video2.mp4
40+
$ python3 deepstream_preprocess_test.py -i rtsp://127.0.0.1/video1 rtsp://127.0.0.1/video2
2841

2942
This document describes the sample deepstream_preprocess-test application
3043

bindings/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
5050

5151
# Setting python build versions
5252
set(PYTHON_VERSION ${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION})
53-
set(PIP_WHEEL pyds-1.1.2-py3-none-${PIP_PLATFORM}.whl)
53+
set(PIP_WHEEL pyds-1.1.3-py3-none-${PIP_PLATFORM}.whl)
5454

5555
# Describing pyds build
5656
project(pyds DESCRIPTION "Python bindings for Deepstream")
@@ -99,7 +99,7 @@ function(add_ds_lib libname)
9999
target_link_libraries(pyds ${libname})
100100
endfunction()
101101

102-
foreach(nvds_lib nvds_osd nvds_meta nvds_infer nvdsgst_meta nvbufsurface nvbufsurftransform)
102+
foreach(nvds_lib nvds_osd nvds_meta nvds_infer nvdsgst_meta nvbufsurface nvbufsurftransform nvdsgst_helper)
103103
add_ds_lib(${nvds_lib})
104104
endforeach()
105105

bindings/README.md

Lines changed: 121 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,128 @@
1-
# Deepstream python bindings
2-
3-
## 1 - Purpose
4-
5-
This file describes how to compile and install deepstream python bindings
6-
7-
## 2 - Prerequisites
8-
9-
The following dependencies need to be met:
1+
# DeepStream python bindings
2+
3+
SDK version supported: 6.1
4+
5+
The latest prebuilt release package complete with python bindings and sample applications can be downloaded from the [release section](../../../releases)
6+
for both x86 and Jetson platforms.
7+
8+
This readme describes how to compile and install DeepStream python bindings (henceforth referred as bindings). This process is mainly useful for making customizations in the bindings and compiling it yourself instead of using the prebuilt versions provided in the release section.
9+
10+
The readme is divided into three main parts:
11+
- [DeepStream python bindings](#deepstream-python-bindings)
12+
- [1 - Prerequisites](#1-prerequisites)
13+
- [1.1 - Deepstream SDK](#11-deepstream-sdk)
14+
- [1.2 Base dependencies](#12-base-dependencies)
15+
- [1.3 Initialization of submodules](#13-initialization-of-submodules)
16+
- [1.4 Installing Gst-python](#14-installing-gst-python)
17+
- [2 - Compiling the bindings](#2-compiling-the-bindings)
18+
- [2.1 Quick build (x86-ubuntu-18.04 | python 3.6 | Deepstream 6.0.1)](#21-quick-build-x86-ubuntu-1804--python-36--deepstream-601)
19+
- [2.1.1 Quick build (x86-ubuntu-20.04 | python 3.8 | Deepstream 6.1)](#211-quick-build-x86-ubuntu-2004--python-38--deepstream-61)
20+
- [2.2 Advanced build](#22-advanced-build)
21+
- [2.2.1 Using Cmake options](#221-using-cmake-options)
22+
- [2.2.2 Available cmake options](#222-available-cmake-options)
23+
- [2.2.3 Example](#223-example)
24+
- [2.3 Cross-Compilation for aarch64 on x86](#23-cross-compilation-for-aarch64-on-x86)
25+
- [2.3.1 Build Pre-requisites](#231-build-pre-requisites)
26+
- [2.3.2 Download the JetPack SDK 5.0.1 DP](#232-download-the-jetpack-sdk-501-dp)
27+
- [2.3.3 Generate the cross-compile build container](#233-generate-the-cross-compile-build-container)
28+
- [2.3.4 Launch the cross-compile build container](#234-launch-the-cross-compile-build-container)
29+
- [2.3.5 Build DeepStreamSDK python bindings](#235-build-deepstreamsdk-python-bindings)
30+
- [3 - Installing the bindings](#3-installing-the-bindings)
31+
- [3.1 Installing the pip wheel](#31-installing-the-pip-wheel)
32+
- [3.1.1 pip wheel troubleshooting](#311-pip-wheel-troubleshooting)
33+
- [3.2 Launching test-1 app](#32-launching-test-1-app)
34+
35+
<a name="prereqs"></a>
36+
## 1 - Prerequisites
37+
38+
The following dependencies need to be met in order to compile bindings:
39+
40+
<a name="prereq_ds"></a>
41+
### 1.1 - Deepstream SDK
42+
Go to https://developer.nvidia.com/deepstream-sdk, download and install Deepstream SDK and its dependencies
1043

11-
### 2.1 Base dependencies
12-
Ubuntu - 18.04 :
44+
<a name="prereq_base"></a>
45+
### 1.2 Base dependencies
46+
To compile bindings on Ubuntu - 18.04 :
1347
```
1448
apt install -y git python-dev python3 python3-pip python3.6-dev python3.8-dev cmake g++ build-essential \
15-
libglib2.0-dev libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake
49+
libglib2.0-dev libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake libgirepository1.0-dev libcairo2-dev
1650
```
1751

18-
Ubuntu - 20.04 [use python-3.8, python-3.6 will not work] :
52+
To compile bindings on Ubuntu - 20.04 [use python-3.8, python-3.6 will not work] :
1953
```
2054
apt install python3-gi python3-dev python3-gst-1.0 python-gi-dev git python-dev \
2155
python3 python3-pip python3.8-dev cmake g++ build-essential libglib2.0-dev \
22-
libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake
56+
libglib2.0-dev-bin libgstreamer1.0-dev libtool m4 autoconf automake libgirepository1.0-dev libcairo2-dev
2357
```
2458

25-
### 2.2 Initialization of submodules
59+
<a name="prereq_init_sub"></a>
60+
### 1.3 Initialization of submodules
61+
Make sure you clone the deepstream_python_apps repo under <DeepStream 6.1 ROOT>/sources:
62+
git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps
63+
64+
This will create the following directory:
2665
```
66+
<DeepStream 6.1 ROOT>/sources/deepstream_python_apps
67+
```
68+
69+
The repository utilizes gst-python and pybind11 submodules.
70+
To initializes them, run the following command:
71+
```bash
72+
cd /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/
2773
git submodule update --init
2874
```
29-
### 2.3 Installing Gst-python
75+
<a name="prereq_install_gst"></a>
76+
### 1.4 Installing Gst-python
3077

3178
Following commands ensure we add the new certificates that gst-python git server now uses:
32-
```
79+
```bash
3380
sudo apt-get install -y apt-transport-https ca-certificates -y
3481
sudo update-ca-certificates
3582
```
3683

3784
Build and install gst-python:
38-
```
85+
```bash
3986
cd 3rdparty/gst-python/
4087
./autogen.sh
4188
make
42-
make install
89+
sudo make install
4390
```
44-
### 2.4 - Deepstream SDK
45-
Go to https://developer.nvidia.com/deepstream-sdk, download and install Deepstream SDK and its dependencies
4691

47-
## 3 - Building the bindings
92+
<a name="compile_bindings"></a>
93+
## 2 - Compiling the bindings
94+
Python bindings are compiled using CMake.
95+
Following commands provide quick cmake configurations for common compilation options:
4896

49-
### 3.1 Quick build (x86-ubuntu-18.04 | python 3.6 | Deepstream 6.0.1)
50-
```
97+
<a name="compile_quick"></a>
98+
### 2.1 Quick build (x86-ubuntu-18.04 | python 3.6 | Deepstream 6.0.1)
99+
```bash
51100
cd deepstream_python_apps/bindings
52101
mkdir build
53102
cd build
54103
cmake .. -DPYTHON_MAJOR_VERSION=3 -DPYTHON_MINOR_VERSION=6
55104
make
56105
```
57106

58-
### 3.1.1 Quick build (x86-ubuntu-20.04 | python 3.8 | Deepstream 6.1)
59-
60-
```
107+
### 2.1.1 Quick build (x86-ubuntu-20.04 | python 3.8 | Deepstream 6.1)
108+
```bash
61109
cd deepstream_python_apps/bindings
62110
mkdir build
63111
cd build
64112
cmake ..
65113
make
66114
```
67115

116+
<a name="compile_advance"></a>
117+
### 2.2 Advanced build
68118

69-
### 3.2 Advanced build
70-
71-
#### 3.2.1 Using Cmake options
119+
#### 2.2.1 Using Cmake options
72120

73-
Multiple options can be passed to cmake as follows:
74-
```
75-
cmake [-D<var>=<value> [-D<var>=<value> [-D<var>=<value> ... ]]]
121+
Multiple options can be used with cmake as follows:
122+
```bash
123+
cmake .. [-D<var>=<value> [-D<var>=<value> [-D<var>=<value> ... ]]]
76124
```
77-
#### 3.2.2 Available cmake options
125+
#### 2.2.2 Available cmake options
78126
79127
| Var | Default value | Purpose | Available values
80128
|-----|:-------------:|---------|:----------------:
@@ -84,11 +132,11 @@ cmake [-D<var>=<value> [-D<var>=<value> [-D<var>=<value> ... ]]]
84132
| PIP_PLATFORM | linux_x86_64 | Used to select the target architecture to compile the bindings | linux_x86_64, linux_aarch64
85133
| DS_PATH | /opt/nvidia/deepstream/deepstream-${DS_VERSION} | Path where deepstream libraries are available | Should match the existing deepstream library folder
86134
87-
#### 3.2.3 Example
135+
#### 2.2.3 Example
88136
89-
Following commands can be used to build the bindings natively on Jetson devices
137+
Following commands can be used to compile the bindings natively on Jetson devices
90138
91-
```
139+
```bash
92140
cd deepstream_python_apps/bindings
93141
mkdir build
94142
cd build
@@ -97,13 +145,14 @@ cmake .. -DPYTHON_MAJOR_VERSION=3 -DPYTHON_MINOR_VERSION=8 \
97145
make
98146
```
99147
100-
### 3.3 Cross-Compilation for aarch64 on x86
148+
<a name="compile_cross"></a>
149+
### 2.3 Cross-Compilation for aarch64 on x86
101150
102151
This section outlines how to enable cross-compiling of the DeepStreamSDK python bindings for aarch64 using Docker on x86 host.
103152
104153
NOTE: This will only emulate the CPU, so any calls requiring embedded hardware, such as using CUDA or inference are not supported.
105154
106-
#### 3.3.1 Build Pre-requisites
155+
#### 2.3.1 Build Pre-requisites
107156
108157
We use [qemu](https://www.qemu.org/) processor emulator to achieve cross-compilation. Qemu can be installed on the x86 Ubuntu host machine as shown below:
109158
@@ -119,41 +168,49 @@ docker run --rm -t nvcr.io/nvidia/deepstream-l4t:6.1-samples uname -m
119168
#aarch64
120169
```
121170
122-
#### 3.3.2 Download the JetPack SDK 5.0.1 DP
171+
#### 2.3.2 Download the JetPack SDK 5.0.1 DP
172+
Cross-compilation for Jetson on x86 host requires some low level libraries which can be downloaded using SDK Manager.
173+
Follow these steps to obtain these libraries, which are utilized by the docker build later.
174+
123175
1. Download and install the [NVIDIA SDK manager](https://developer.nvidia.com/nvidia-sdk-manager)
124176
2. Launch the SDK Manager and login with your NVIDIA developer account.
125177
3. Select the platform and target OS (example: Jetson AGX Xavier, `Linux Jetpack 5.0.1 DP`) and click Continue.
126178
4. Under `Download & Install Options` change the download folder and select `Download now, Install later`. Agree to the license terms and click Continue.
127179
5. Go to the download folder, and run:
128180
129181
```bash
130-
# path/to/deepstream_python_apps is the path where you downloaded the deepstream_python_apps repository
131-
mkdir -p path/to/deepstream_python_apps/bindings/docker/jetpack_files
132-
mv ~/Downloads/nvidia/sdkm_downloads/* path/to/deepstream_python_apps/bindings/docker/jetpack_files
182+
# create directories as follows:
183+
mkdir -p deepstream_python_apps/bindings/docker/jetpack_files
184+
# <path/to> would be /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/
185+
# where you downloaded the deepstream_python_apps repository
186+
mv ~/Downloads/nvidia/sdkm_downloads/* <path/to>/deepstream_python_apps/bindings/docker/jetpack_files
133187
```
134188
135-
#### 3.3.3 Generate the cross-compile build container
189+
#### 2.3.3 Generate the cross-compile build container
136190
137191
Below command generates the build container
138192
139193
```bash
194+
# cd to bindings dir
195+
cd deepstream_python_apps/bindings
140196
# Make sure you are in deepstream_python_apps/bindings directory
197+
# This command builds the cross-compile docker and adds the mentioned tag
141198
docker build --tag=deepstream-6.1-ubuntu20.04-python-l4t -f qemu_docker/ubuntu-cross-aarch64.Dockerfile .
142199
```
143200
144-
#### 3.3.4 Launch the cross-compile build container
201+
#### 2.3.4 Launch the cross-compile build container
145202
146203
```bash
147204
# Create a directory to mount to the container and store your pyds wheel package in
148205
mkdir export_pyds
149206
150-
# Make sure the tag matches the one from Generate step above
207+
# Run the container. Make sure the tag matches the one from Generate step above
151208
docker run -it -v $PWD/export_pyds:/export_pyds deepstream-6.1-ubuntu20.04-python-l4t bash
152209
```
153210
154-
#### 3.3.5 Build DeepStreamSDK python bindings
211+
#### 2.3.5 Build DeepStreamSDK python bindings
155212
156-
Inside the cross-compile docker, run following commands:
213+
After the container launches successfully, while inside the cross-compile docker, run following commands:
157214
158215
```bash
159216
# cd to /opt/nvidia/deepstream/deepstream/sources/ dir
@@ -180,21 +237,27 @@ make -j$(nproc)
180237
cp pyds-*.whl /export_pyds
181238
```
182239
183-
Build output is generated in the created export_pyds directory (deepstream_python_apps/bindings/export_pyds).
240+
Build output (pip wheel) is copied to the previously created export_pyds directory (deepstream_python_apps/bindings/export_pyds) on the host machine.
184241
185-
## 4 - Using the generated pip wheel
242+
<a name="install_bindings"></a>
243+
## 3 - Installing the bindings
244+
Following commands can be used to install the generated pip wheel.
186245
187-
### 4.1 Installing the pip wheel
188-
```
189-
apt install libgirepository1.0-dev libcairo2-dev
190-
pip3 install ./pyds-1.1.2-py3-none*.whl
246+
<a name="install_wheel"></a>
247+
### 3.1 Installing the pip wheel
248+
```bash
249+
pip3 install ./pyds-1.1.3-py3-none*.whl
191250
```
192251
193-
#### 4.1.1 pip wheel troubleshooting
194-
Please make sure you upgrade pip if the wheel installation fails
195-
196-
### 4.2 launching test 1 app
252+
#### 3.1.1 pip wheel troubleshooting
253+
If the wheel installation fails, upgrade the pip using the following command:
254+
```bash
255+
python3 -m pip install --upgrade pip
197256
```
257+
258+
<a name="install_launch"></a>
259+
### 3.2 Launching test-1 app
260+
```bash
198261
cd apps/deepstream-test1
199262
python3 deepstream_test_1.py <input .h264 file>
200263
```

bindings/docstrings/pydocumentation.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,6 +2057,14 @@ namespace pydsdoc
20572057
:arg index: index of buffer in the batch. -1 for all buffers in batch.
20582058
20592059
:returns: 0 for success, -1 for failure.)pyds";
2060+
2061+
constexpr const char* gst_nvevent_new_stream_reset=R"pyds(
2062+
Creates a "custom reset" event for the specified source.
2063+
2064+
This function can be used to reset the source in case RTSP reconnection
2065+
is required.
2066+
2067+
:arg source_id: source id for which this event needs to be generated.)pyds";
20602068
}
20612069

20622070
namespace nvoptical

bindings/include/pyds.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "nvdsmeta_schema.h"
3434
#include "nvdsinfer.h"
3535
#include "gstnvdsinfer.h"
36+
#include "gst-nvevent.h"
3637
#include <iostream>
3738

3839
#include <mutex>

bindings/packaging/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
setuptools.setup(
1919
name="pyds",
20-
version="1.1.2",
20+
version="1.1.3",
2121
author="NVIDIA",
2222
description="Install precompiled DeepStream Python bindings extension",
2323
url="nvidia.com",

0 commit comments

Comments
 (0)