Skip to content

Commit 971626b

Browse files
committed
Update to 1.0 release
- The bindings are now shipped with the SDK. Update import path and documentation for that. - Optimized test3 app performance by adding queues. - Adjust ssd-parser app config to work on NX. Added instructions for running this app on Nano. - Config updates to sync up with the SDK.
1 parent 2931f6b commit 971626b

25 files changed

Lines changed: 188 additions & 121 deletions

FAQ.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [Error on setting string field](#faq5)
99
* [Pipeline unable to perform at real time](#faq6)
1010
* [Triton container problems with multi-GPU setup](#faq7)
11+
* [ModuleNotFoundError: No module named 'pyds'] (#faq8)
1112

1213
<a name="faq0"></a>
1314
### Application fails to work with mp4 stream
@@ -93,10 +94,21 @@ The application appears to be stuck without any playback activity.
9394
a) probe() callbacks are synchronous and thus holds the buffer
9495
(info.get_buffer()) from traversing the pipeline until user return.
9596
b) loops inside probe() callback could be costly in python.
97+
9698

9799
<a name="faq7"></a>
98100
### Triton container problems with multi-GPU setup
99101
The Triton Inference Server plugin currently only supports single-GPU usage.
100102
When running the docker, please specify
101103
`--gpus device=<GPU ID>`
102-
e.g.: `--gpus device=0`
104+
e.g.: `--gpus device=0`
105+
106+
107+
<a name="faq8"></a>
108+
### ModuleNotFoundError: No module named 'pyds'
109+
The pyds extension is installed under /opt/nvidia/deepstream/deepstream/lib
110+
The sample applications all include this path via the is_aarch_64 module.
111+
A setup.py is also provided to install this extension into standard path.
112+
Currently this needs to be run manually:
113+
$ cd /opt/nvidia/deepstream/deepstream/lib
114+
$ python3 setup.py install

HOWTO.md

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This guide provides resources for DeepStream application development in Python.
1616
## Prerequisites
1717

1818
* Ubuntu 18.04
19-
* [DeepStream SDK 5.0 Developer Preview](https://developer.nvidia.com/deepstream-download) or later
19+
* [DeepStream SDK 5.0](https://developer.nvidia.com/deepstream-download) or later
2020
* Python 3.6
2121
* [Gst Python](https://gstreamer.freedesktop.org/modules/gst-python.html) v1.14.5
2222

@@ -38,13 +38,13 @@ If missing, install with the following steps:
3838
<a name="run_samples"></a>
3939
## Running Sample Applications
4040

41-
Download the release package and unpack it under DS 5.0 installation:
42-
```tar xf ds_pybind_v0.9.tbz2 -C <DeepStream 5.0 ROOT>/sources```
41+
Clone the deepstream_python_apps repo under <DeepStream 5.0 ROOT>/sources:
42+
git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps
4343

4444
This will create the following directory:
45-
```<DeepStream 5.0 ROOT>/sources/python```
45+
```<DeepStream 5.0 ROOT>/sources/deepstream_python_apps```
4646

47-
The Python apps and bindings are under the "python" directory.
47+
The Python apps are under the "apps" directory.
4848
Go into each app directory and follow instructions in the README.
4949

5050
NOTE: The app configuration files contain relative paths for models.
@@ -60,23 +60,13 @@ See [sample applications](apps/) main functions for pipeline construction exampl
6060

6161
DeepStream MetaData contains inference results and other information used in analytics. The MetaData is attached to the Gst Buffer received by each pipeline component. The metadata format is described in detail in the [SDK MetaData documentation](https://docs.nvidia.com/metropolis/deepstream/plugin-manual/index.html#page/DeepStream_Plugin_Manual%2Fdeepstream_plugin_metadata.03.1.html) and [API Guide](https://docs.nvidia.com/metropolis/deepstream/python-api/index.html).
6262

63-
The SDK MetaData library is developed in C/C++. Python bindings provide access to the MetaData from Python applications. The bindings are provided in a compiled module, available for x86_64 and Jetson platforms. Find them in the release package with the following layout:
64-
```
65-
bindings
66-
|- x86_64
67-
| |- pyds.so
68-
|- jetson
69-
|- pyds.so
70-
```
63+
The SDK MetaData library is developed in C/C++. Python bindings provide access to the MetaData from Python applications. The bindings are provided in a compiled module, available for x86_64 and Jetson platforms. This module, pyds.so, is available as part of the DeepStream SDK installation under <DeepStream Root>/lib directory.
7164

72-
Applications can import the module thus:
73-
```python
74-
import sys
75-
sys.path.append('../') # Add path to the bindings directory
76-
# The common/is_aarch64.py module adds the platform-specific path to pyds module
77-
from common.is_aarch64 import is_aarch64
78-
import pyds
79-
```
65+
The sample applications gets the import path for this module through common/utils.py. A setup.py is also included for installing the module into standard path:
66+
cd /opt/nvidia/deepstream/deepstream/lib
67+
python3 setup.py install
68+
69+
This is currently not automatically done through the SDK installer because python usage is optional.
8070

8171
The bindings generally follow the same API as the underlying C/C++ library, with a few exceptions detailed in sections below.
8272

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
This repository contains Python bindings and sample applications for the [DeepStream SDK](https://developer.nvidia.com/deepstream-sdk).
44

5-
The bindings and apps are currently in *Alpha* at v0.9. The API is maturing but changes are still expected.
6-
SDK version supported: 5.0 Developer Preview
5+
SDK version supported: 5.0
76

87
Download the latest release package complete with bindings and sample applications from the [release section](../../releases).
98

@@ -16,7 +15,7 @@ Please report any issues or bugs on the [Deepstream SDK Forums](https://devtalk.
1615
## Python Bindings
1716

1817
DeepStream pipelines can be constructed using Gst Python, the GStreamer framework's Python bindings. For accessing DeepStream MetaData,
19-
Python bindings are provided in the form of a compiled module. Download these bindings [here](https://developer.nvidia.com/deepstream-download#python_bindings). This module is generated using [Pybind11](https://github.com/pybind/pybind11).
18+
Python bindings are provided in the form of a compiled module which is included in the DeepStream SDK. This module is generated using [Pybind11](https://github.com/pybind/pybind11).
2019

2120
<p align="center">
2221
<img src=".python-app-pipeline.png" alt="bindings pipeline" height="600px"/>

apps/README

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ Package Contents
3434
--------------------------------------------------------------------------------
3535
The DeepStream Python package includes:
3636
1. Python bindings for DeepStream Metadata libraries
37-
These bindings are provided as a compiled module, available for
38-
x86_64 and Jetson platforms. Find them at:
39-
bindings
40-
|- x86_64
41-
| |- pyds.so
42-
|- jetson
43-
|- pyds.so
37+
These bindings are installed as part of the SDK at:
38+
/opt/nvidia/deepstream/deepstream/lib/pyds.so
39+
40+
Sample applications that import is_aarch_64 automatically
41+
have this path added.
42+
43+
A setup.py is also provided to install this extension into standard path.
44+
Currently this needs to be run manually:
45+
$ cd /opt/nvidia/deepstream/deepstream/lib
46+
$ python3 setup.py install
47+
4448
2. DeepStream test apps in Python
4549
The following test apps are available:
4650
deepstream-test1
@@ -75,10 +79,11 @@ $ sudo apt install python3-gi python3-dev python3-gst-1.0 -y
7579
Running the samples
7680
--------------------------------------------------------------------------------
7781
The apps are configured to work from inside the DeepStream SDK 5.0 installation.
78-
Untar the contents into <DeepStream install root>/sources/.
7982

80-
Note that the apps import the pyds module from this relative path:
81-
../bindings/<platform>
83+
Clone the deepstream_python_apps repo under <DeepStream 5.0 ROOT>/sources:
84+
$ git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps
85+
This will create the following directory:
86+
<DeepStream 5.0 ROOT>/sources/deepstream_python_apps
8287

8388
Follow README in each app's directory to run the app.
8489

apps/common/is_aarch_64.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@
2727
def is_aarch64():
2828
return platform.uname()[4] == 'aarch64'
2929

30-
31-
sys.path.append('../../bindings/' + ('jetson' if is_aarch64() else 'x86_64'))
30+
sys.path.append('/opt/nvidia/deepstream/deepstream/lib')

apps/common/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
################################################################################
2222

2323
import ctypes
24+
import sys
25+
sys.path.append('/opt/nvidia/deepstream/deepstream/lib')
2426

2527
def long_to_int(l):
2628
value = ctypes.c_int(l & 0xffffffff).value

apps/deepstream-imagedata-multistream/dstest_imagedata_config.txt

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# num-detected-classes
3131
#
3232
# Optional properties for detectors:
33-
# enable-dbscan(Default=false), interval(Primary mode only, Default=0)
33+
# cluster-mode(Default=Group Rectangles), interval(Primary mode only, Default=0)
3434
# custom-lib-path
3535
# parse-bbox-func-name
3636
#
@@ -51,7 +51,7 @@
5151
# Other optional properties:
5252
# net-scale-factor(Default=1), network-mode(Default=0 i.e FP32),
5353
# model-color-format(Default=0 i.e. RGB) model-engine-file, labelfile-path,
54-
# mean-file, gie-unique-id(Default=0), offsets, gie-mode (Default=1 i.e. primary),
54+
# mean-file, gie-unique-id(Default=0), offsets, process-mode (Default=1 i.e. primary),
5555
# custom-lib-path, network-mode(Default=0 i.e FP32)
5656
#
5757
# The values in the config file are overridden by values set through GObject
@@ -62,8 +62,10 @@ gpu-id=0
6262
net-scale-factor=0.0039215697906911373
6363
model-file=../../../../samples/models/Primary_Detector/resnet10.caffemodel
6464
proto-file=../../../../samples/models/Primary_Detector/resnet10.prototxt
65+
model-engine-file=../../../../samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
6566
labelfile-path=../../../../samples/models/Primary_Detector/labels.txt
6667
int8-calib-file=../../../../samples/models/Primary_Detector/cal_trt.bin
68+
force-implicit-batch-dim=1
6769
batch-size=1
6870
process-mode=1
6971
model-color-format=0
@@ -79,3 +81,30 @@ cluster-mode=1
7981
threshold=0.2
8082
eps=0.7
8183
minBoxes=1
84+
85+
#Use the config params below for dbscan clustering mode
86+
[class-attrs-all]
87+
detected-min-w=4
88+
detected-min-h=4
89+
minBoxes=3
90+
91+
## Per class configurations
92+
[class-attrs-0]
93+
pre-cluster-threshold=0.05
94+
eps=0.7
95+
dbscan-min-score=0.95
96+
97+
[class-attrs-1]
98+
pre-cluster-threshold=0.05
99+
eps=0.7
100+
dbscan-min-score=0.5
101+
102+
[class-attrs-2]
103+
pre-cluster-threshold=0.1
104+
eps=0.6
105+
dbscan-min-score=0.95
106+
107+
[class-attrs-3]
108+
pre-cluster-threshold=0.05
109+
eps=0.7
110+
dbscan-min-score=0.5
46.3 KB
Loading

apps/deepstream-ssd-parser/README

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,26 @@ This example:
7070
- Encodes OSD output and saves to MP4 file. Note that there is no visual output on screen.
7171

7272
Known Issue:
73-
On Jetson, if libgomp is not preloaded, this error may occur:
73+
1. On Jetson, if libgomp is not preloaded, this error may occur:
7474
(python3:21041): GStreamer-WARNING **: 14:35:44.113: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstlibav.so': /usr/lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block
7575
Unable to create Encoder
7676

77+
2. On Jetson Nano, ssd_inception_v2 is not expected to run with GPU instance.
78+
Switch to CPU instance when running on Nano:
79+
update config.pbtxt files in samples/trtis_modeo_repo:
80+
# Switch to CPU instance for Nano since memory might not be enough for
81+
# certain Models.
82+
83+
# Specify CPU instance.
84+
instance_group {
85+
count: 1
86+
kind: KIND_CPU
87+
}
88+
89+
# Specify GPU instance.
90+
#instance_group {
91+
# kind: KIND_GPU
92+
# count: 1
93+
# gpus: 0
94+
#}
95+

apps/deepstream-ssd-parser/dstest_ssd_nopostprocess.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ infer_config {
99
model_repo {
1010
root: "../../../../samples/trtis_model_repo"
1111
log_level: 2
12-
tf_gpu_memory_fraction: 0.6
12+
tf_gpu_memory_fraction: 0.4
1313
tf_disable_soft_placement: 0
1414
}
1515
}

0 commit comments

Comments
 (0)