Skip to content

Commit e4da85d

Browse files
committed
Update to 1.1.2 release
This release is compatible with DeepStream SDK 6.1 Ubuntu 20.04 Python 3.8 DeepStream SDK 6.1 Features: - New Preprocess test app which demonstrates using nvdspreprocess plugin with custom ROIs - Enhanced Test3 to support Triton, no-display mode, file-loop, and silent mode - Minor improvements and bug fixes
1 parent 31d1d1a commit e4da85d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1508
-293
lines changed

HOWTO.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ This guide provides resources for DeepStream application development in Python.
1515
<a name="prereqs"></a>
1616
## Prerequisites
1717

18-
* Ubuntu 18.04
19-
* [DeepStream SDK 6.0.1](https://developer.nvidia.com/deepstream-download) or later
20-
* Python 3.6+
21-
* [Gst Python](https://gstreamer.freedesktop.org/modules/gst-python.html) v1.14.5
18+
* Ubuntu 20.04
19+
* [DeepStream SDK 6.1](https://developer.nvidia.com/deepstream-download) or later
20+
* Python 3.8
21+
* [Gst Python](https://gstreamer.freedesktop.org/modules/gst-python.html) v1.16.2
2222

2323
Gst python should be already installed on Jetson.
2424
If missing, install with the following steps:
@@ -28,7 +28,7 @@ If missing, install with the following steps:
2828
$ export GST_CFLAGS="-pthread -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include"
2929
$ git clone https://github.com/GStreamer/gst-python.git
3030
$ cd gst-python
31-
$ git checkout 1a8f48a
31+
$ git checkout 5343aeb
3232
$ ./autogen.sh PYTHON=python3
3333
$ ./configure PYTHON=python3
3434
$ make
@@ -45,11 +45,11 @@ Note: Compiling bindings now also generates a pip installable python wheel for t
4545
<a name="run_samples"></a>
4646
## Running Sample Applications
4747

48-
Clone the deepstream_python_apps repo under <DeepStream 6.0.1 ROOT>/sources:
48+
Clone the deepstream_python_apps repo under <DeepStream 6.1 ROOT>/sources:
4949
git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps
5050

5151
This will create the following directory:
52-
```<DeepStream 6.0.1 ROOT>/sources/deepstream_python_apps```
52+
```<DeepStream 6.1 ROOT>/sources/deepstream_python_apps```
5353

5454
The Python apps are under the "apps" directory.
5555
Go into each app directory and follow instructions in the README.

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

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

5-
SDK version supported: 6.0.1
5+
SDK version supported: 6.1
66

7-
<b>NEW: The bindings sources along with build instructions are now available under [bindings](bindings)! </b>
7+
<b>The bindings sources along with build instructions are now available under [bindings](bindings)! </b>
8+
9+
<b>This release comes with Operating System upgrades (from Ubuntu 18.04 to Ubuntu 20.04) for DeepStreamSDK 6.1 support. This translates to upgrade in Python version to 3.8 and [gst-python](3rdparty/gst-python/) version has also been upgraded to 1.16.2 !</b>
810

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

@@ -41,7 +43,7 @@ To run the sample applications or write your own, please consult the [HOW-TO Gui
4143
We currently provide the following sample applications:
4244
* [deepstream-test1](apps/deepstream-test1) -- 4-class object detection pipeline
4345
* [deepstream-test2](apps/deepstream-test2) -- 4-class object detection, tracking and attribute classification pipeline
44-
* [deepstream-test3](apps/deepstream-test3) -- multi-stream pipeline performing 4-class object detection
46+
* <b>UPDATE</b> [deepstream-test3](apps/deepstream-test3) -- multi-stream pipeline performing 4-class object detection - now also supports triton inference server, no-display mode, file-loop and silent mode
4547
* [deepstream-test4](apps/deepstream-test4) -- msgbroker for sending analytics results to the cloud
4648
* [deepstream-imagedata-multistream](apps/deepstream-imagedata-multistream) -- multi-stream pipeline with access to image buffers
4749
* [deepstream-ssd-parser](apps/deepstream-ssd-parser) -- SSD model inference via Triton server with output parsing in Python
@@ -53,6 +55,7 @@ We currently provide the following sample applications:
5355
* [runtime_source_add_delete](apps/runtime_source_add_delete) -- add/delete source streams at runtime
5456
* [deepstream-imagedata-multistream-redaction](apps/deepstream-imagedata-multistream-redaction) -- multi-stream pipeline with face detection and redaction
5557
* [deepstream-rtsp-in-rtsp-out](apps/deepstream-rtsp-in-rtsp-out) -- multi-stream pipeline with RTSP input/output
58+
* <b>NEW</b> [deepstream-preprocess-test](apps/deepstream-preprocess-test) -- multi-stream pipeline using nvdspreprocess plugin with custom ROIs
5659

5760

5861
Detailed application information is provided in each application's subdirectory under [apps](apps).

apps/README

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,52 +19,46 @@
1919
DeepStream SDK Python Bindings
2020
================================================================================
2121
Setup pre-requisites:
22-
- Ubuntu 18.04
23-
- NVIDIA DeepStream SDK 6.0.1
24-
- Python 3.6
22+
- Ubuntu 20.04
23+
- NVIDIA DeepStream SDK 6.1
24+
- Python 3.8
2525
- Gst-python
2626

2727
--------------------------------------------------------------------------------
2828
Package Contents
2929
--------------------------------------------------------------------------------
30-
The DeepStream Python package includes:
31-
1. Python bindings for DeepStream Metadata libraries
32-
These bindings are installed as part of the SDK at:
33-
/opt/nvidia/deepstream/deepstream/lib/pyds.so
34-
35-
Sample applications that import is_aarch_64 automatically
36-
have this path added.
30+
1. DeepStream Python bindings located in bindings dir
31+
with installation instructions in bindings/README.md
3732

38-
A setup.py is also provided to install this extension into standard path.
39-
Currently this needs to be run manually:
40-
$ cd /opt/nvidia/deepstream/deepstream/lib
41-
$ python3 setup.py install
42-
4333
2. DeepStream test apps in Python
4434
The following test apps are available:
4535
deepstream-test1
4636
deepstream-test2
4737
deepstream-test3
4838
deepstream-test4
4939
deepstream-imagedata-multistream
40+
deepstream-imagedata-multistream-redaction
5041
deepstream-ssd-parser
5142
deepstream-test1-rtsp-out
43+
deepstream-rtsp-in-rtsp-out
5244
deepstream-test1-usbcam
5345
deepstream-opticalflow
5446
deepstream-segmentation
5547
deepstream-nvdsanalytics
48+
deepstream-preprocess-test
49+
runtime_source_add_delete
5650

5751
--------------------------------------------------------------------------------
5852
Installing Pre-requisites:
5953
--------------------------------------------------------------------------------
6054

61-
DeepStream SDK 6.0.1
55+
DeepStream SDK 6.1
6256
--------------------
6357
Download and install from https://developer.nvidia.com/deepstream-download
6458

65-
Python 3.6
59+
Python 3.8
6660
----------
67-
Should be already installed with Ubuntu 18.04
61+
Should be already installed with Ubuntu 20.04
6862

6963
Gst-python
7064
----------
@@ -76,7 +70,7 @@ $ sudo apt install python3-gi python3-dev python3-gst-1.0 -y
7670
--------------------------------------------------------------------------------
7771
Running the samples
7872
--------------------------------------------------------------------------------
79-
The apps are configured to work from inside the DeepStream SDK 6.0.1 installation.
73+
The apps are configured to work from inside the DeepStream SDK 6.1 installation.
8074

8175
Clone the deepstream_python_apps repo under <DeepStream ROOT>/sources:
8276
$ git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps

apps/common/FPS.py

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,52 @@
1616
################################################################################
1717

1818
import time
19+
from threading import Lock
1920
start_time=time.time()
20-
frame_count=0
21+
22+
fps_mutex = Lock()
2123

2224
class GETFPS:
2325
def __init__(self,stream_id):
2426
global start_time
2527
self.start_time=start_time
2628
self.is_first=True
27-
global frame_count
28-
self.frame_count=frame_count
29+
self.frame_count=0
2930
self.stream_id=stream_id
30-
def get_fps(self):
31-
end_time=time.time()
32-
if(self.is_first):
33-
self.start_time=end_time
34-
self.is_first=False
35-
if(end_time-self.start_time>5):
36-
print("**********************FPS*****************************************")
37-
print("Fps of stream",self.stream_id,"is ", float(self.frame_count)/5.0)
38-
self.frame_count=0
39-
self.start_time=end_time
31+
32+
def update_fps(self):
33+
end_time = time.time()
34+
if self.is_first:
35+
self.start_time = end_time
36+
self.is_first = False
4037
else:
41-
self.frame_count=self.frame_count+1
38+
global fps_mutex
39+
with fps_mutex:
40+
self.frame_count = self.frame_count + 1
41+
42+
def get_fps(self):
43+
end_time = time.time()
44+
with fps_mutex:
45+
stream_fps = float(self.frame_count/(end_time - self.start_time))
46+
self.frame_count = 0
47+
self.start_time = end_time
48+
return round(stream_fps, 2)
49+
4250
def print_data(self):
4351
print('frame_count=',self.frame_count)
4452
print('start_time=',self.start_time)
4553

54+
class PERF_DATA:
55+
def __init__(self, num_streams=1):
56+
self.perf_dict = {}
57+
self.all_stream_fps = {}
58+
for i in range(num_streams):
59+
self.all_stream_fps["stream{0}".format(i)]=GETFPS(i)
60+
61+
def perf_print_callback(self):
62+
self.perf_dict = {stream_index:stream.get_fps() for (stream_index, stream) in self.all_stream_fps.items()}
63+
print ("\n**PERF: ", self.perf_dict, "\n")
64+
return True
65+
66+
def update_fps(self, stream_index):
67+
self.all_stream_fps[stream_index].update_fps()

apps/common/bus_call.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import gi
1919
import sys
2020
gi.require_version('Gst', '1.0')
21-
from gi.repository import GObject, Gst
21+
from gi.repository import Gst
2222
def bus_call(bus, message, loop):
2323
t = message.type
2424
if t == Gst.MessageType.EOS:

apps/deepstream-imagedata-multistream-redaction/README

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
################################################################################
1717

1818
Prerequisites:
19-
- DeepStreamSDK 6.0.1
20-
- Python 3.6
19+
- DeepStreamSDK 6.1
20+
- Python 3.8
2121
- Gst-python
2222
- NumPy package
2323
- OpenCV package
@@ -39,10 +39,8 @@ Yet, we need to install the introspection typelib package:
3939
$ sudo apt-get install gobject-introspection gir1.2-gst-rtsp-server-1.0
4040

4141
Download Peoplenet model:
42-
$ cd /opt/nvidia/deepstream/deepstream/samples/configs/tao_pretrained_models
43-
$ mkdir -p ../../models/tao_pretrained_models/peoplenet && wget https://api.ngc.nvidia.com/v2/models/nvidia/tao/peoplenet/versions/pruned_v2.1/files/resnet34_peoplenet_pruned.etlt \
44-
-O ../../models/tao_pretrained_models/peoplenet/resnet34_peoplenet_pruned.etlt
45-
$ wget https://api.ngc.nvidia.com/v2/models/nvidia/tao/peoplenet/versions/pruned_v2.1/files/labels.txt -O ../../../configs/tao_pretrained_models/labels_peoplenet.txt
42+
Please follow instructions from the README.md located at : /opt/nvidia/deepstream/deepstream/samples/configs/tao_pretrained_models/README.md
43+
to download latest supported peoplenet model (V2.5 for this release)
4644

4745
To run:
4846
$ python3 deepstream_imagedata-multistream_redaction.py -i <uri1> [uri2] ... [uriN] -c {H264,H265} -b BITRATE

apps/deepstream-imagedata-multistream-redaction/config_infer_primary_peoplenet.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
gpu-id=0
2020
net-scale-factor=0.0039215697906911373
2121
tlt-model-key=tlt_encode
22-
tlt-encoded-model=../../../../samples/models/tao_pretrained_models/peoplenet/resnet34_peoplenet_pruned.etlt
23-
labelfile-path=../../../../samples/configs/tao_pretrained_models/labels_peoplenet.txt
24-
model-engine-file=../../../../samples/models/tao_pretrained_models/peoplenet/resnet34_peoplenet_pruned.etlt_b1_gpu0_fp16.engine
22+
tlt-encoded-model=../../../../samples/models/tao_pretrained_models/peopleNet/V2.5/resnet34_peoplenet_int8.etlt
23+
labelfile-path=../../../../samples/models/tao_pretrained_models/peopleNet/V2.5/labels.txt
24+
model-engine-file=../../../../samples/models/tao_pretrained_models/peopleNet/V2.5/resnet34_peoplenet_int8.etlt_b1_gpu0_int8.engine
25+
int8-calib-file=../../../../samples/models/tao_pretrained_models/peopleNet/V2.5/resnet34_peoplenet_int8.txt
2526
input-dims=3;544;960;0
2627
uff-input-blob-name=input_1
2728
batch-size=1

apps/deepstream-imagedata-multistream-redaction/deepstream_imagedata-multistream_redaction.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626

2727
gi.require_version('Gst', '1.0')
2828
gi.require_version('GstRtspServer', '1.0')
29-
from gi.repository import GObject, Gst, GstRtspServer
30-
from gi.repository import GLib
29+
from gi.repository import GLib, Gst, GstRtspServer
3130
from ctypes import *
3231
import time
3332
import sys
@@ -36,15 +35,15 @@
3635
from common.is_aarch_64 import is_aarch64
3736
from common.bus_call import bus_call
3837

39-
from common.FPS import GETFPS
38+
from common.FPS import PERF_DATA
4039
import numpy as np
4140
import pyds
4241
import cv2
4342
import os
4443
import os.path
4544
from os import path
4645

47-
fps_streams = {}
46+
perf_data = None
4847
frame_count = {}
4948
saved_count = {}
5049
global PGIE_CLASS_ID_PERSON
@@ -152,8 +151,10 @@ def tiler_sink_pad_buffer_probe(pad, info, u_data):
152151

153152
print("Frame Number=", frame_number, "Number of Objects=", num_rects, "Face_count=",
154153
obj_counter[PGIE_CLASS_ID_FACE], "Person_count=", obj_counter[PGIE_CLASS_ID_PERSON])
155-
# Get frame rate through this probe
156-
fps_streams["stream{0}".format(frame_meta.pad_index)].get_fps()
154+
# Update frame rate through this probe
155+
stream_index = "stream{0}".format(frame_meta.pad_index)
156+
global perf_data
157+
perf_data.update_fps(stream_index)
157158
if save_image:
158159
img_path = "{}/stream_{}/frame_{}.jpg".format(folder_name, frame_meta.pad_index, frame_number)
159160
cv2.imwrite(img_path, frame_copy)
@@ -247,12 +248,11 @@ def create_source_bin(index, uri):
247248
return None
248249
return nbin
249250

250-
251251
def main(uri_inputs,codec,bitrate ):
252252
# Check input arguments
253253
number_sources = len(uri_inputs)
254-
for i in range(0, number_sources ):
255-
fps_streams["stream{0}".format(i)] = GETFPS(i)
254+
global perf_data
255+
perf_data = PERF_DATA(number_sources)
256256

257257
global folder_name
258258
folder_name = "out_crops"
@@ -264,7 +264,6 @@ def main(uri_inputs,codec,bitrate ):
264264
os.mkdir(folder_name)
265265
print("Frames will be saved in ", folder_name)
266266
# Standard GStreamer initialization
267-
GObject.threads_init()
268267
Gst.init(None)
269268

270269
# Create gstreamer elements */
@@ -352,7 +351,7 @@ def main(uri_inputs,codec,bitrate ):
352351
if is_aarch64():
353352
encoder.set_property('preset-level', 1)
354353
encoder.set_property('insert-sps-pps', 1)
355-
encoder.set_property('bufapi-version', 1)
354+
#encoder.set_property('bufapi-version', 1)
356355

357356
# Make the payload-encode video into RTP packets
358357
if codec == "H264":
@@ -430,7 +429,7 @@ def main(uri_inputs,codec,bitrate ):
430429
rtppay.link(sink)
431430

432431
# create an event loop and feed gstreamer bus mesages to it
433-
loop = GObject.MainLoop()
432+
loop = GLib.MainLoop()
434433
bus = pipeline.get_bus()
435434
bus.add_signal_watch()
436435
bus.connect("message", bus_call, loop)
@@ -454,6 +453,8 @@ def main(uri_inputs,codec,bitrate ):
454453
sys.stderr.write(" Unable to get sink pad \n")
455454
else:
456455
tiler_sink_pad.add_probe(Gst.PadProbeType.BUFFER, tiler_sink_pad_buffer_probe, 0)
456+
# perf callback function to print fps every 5 sec
457+
GLib.timeout_add(5000, perf_data.perf_print_callback)
457458

458459

459460
print("Starting pipeline \n")

apps/deepstream-imagedata-multistream/README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
################################################################################
1717

1818
Prerequisites:
19-
- DeepStreamSDK 6.0.1
20-
- Python 3.6
19+
- DeepStreamSDK 6.1
20+
- Python 3.8
2121
- Gst-python
2222
- NumPy package
2323
- OpenCV package

0 commit comments

Comments
 (0)