Skip to content

Commit

Permalink
Update to 1.1.11 Release
Browse files Browse the repository at this point in the history
This release is compatible with DeepStream SDK 7.0

Ubuntu 22.04
Python 3.10
DeepStream SDK 7.0

Features:
- New module platform_info() has been added for checking for WSL, integrated GPU, and aarch64. All apps and integration tests have been updated to use this module when checking for platform. See deepstream_test1 for simple usage.
- SBSA is now supported. Check bindings/README.md for quick build instructions.
- Apps have been updated to use request_pad_simple() instead of the deprecated method get_request_pad(). See gst-python API documentation for details.
- New API nvds_measure_buffer_latency() has been added for pipeline and component latency measurement. See deepstream-test3 app and bindfunctions.cpp for reference.
  • Loading branch information
nv-camilleh committed May 6, 2024
1 parent 36fdc7e commit 216ce3a
Show file tree
Hide file tree
Showing 99 changed files with 620 additions and 299 deletions.
2 changes: 1 addition & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,5 @@ The pyds wheel installs the pyds.so library where all the pip packages are store

Command to install the pyds wheel is:
```bash
$ pip3 install ./pyds-1.1.10-py3-none*.whl
$ pip3 install ./pyds-1.1.11-py3-none*.whl
```
2 changes: 1 addition & 1 deletion HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This guide provides resources for DeepStream application development in Python.
## Prerequisites

* Ubuntu 22.04
* [DeepStream SDK 6.4](https://developer.nvidia.com/deepstream-download) or later
* [DeepStream SDK 7.0](https://developer.nvidia.com/deepstream-download) or later
* Python 3.10
* [Gst Python](https://gstreamer.freedesktop.org/modules/gst-python.html) v1.20.3

Expand Down
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@

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

SDK version supported: 6.4
SDK version supported: 7.0

<b>This release only supports Ubuntu 22.04 for DeepStreamSDK 6.4 with Python 3.10 and [gst-python](3rdparty/gst-python/) 1.20.3! Ubuntu 20.04 for DeepStreamSDK 6.3 with Python 3.8 support is NOW DEPRECATED</b>
<b>This release only supports Ubuntu 22.04 for DeepStreamSDK 7.0 with Python 3.10 and [gst-python](3rdparty/gst-python/) 1.20.3! Ubuntu 20.04 for DeepStreamSDK 6.3 with Python 3.8 support is NOW DEPRECATED</b>

The bindings sources along with build instructions are available under [bindings](bindings)! We include one [guide](bindings/BINDINGSGUIDE.md) for contributing to bindings and another [guide](bindings/CUSTOMUSERMETAGUIDE.md) for advanced use-cases such as writing bindings for custom data structures.

Download the latest release package complete with bindings and sample applications from the [release section](../../releases).
The bindings sources along with build instructions are available under [bindings](bindings)! We include one [guide](bindings/BINDINGSGUIDE.md) for contributing to bindings and another [guide](bindings/CUSTOMUSERMETAGUIDE.md) for advanced use-cases such as writing bindings for custom data structures.

Please report any issues or bugs on the [DeepStream SDK Forums](https://devtalk.nvidia.com/default/board/209). This enables the DeepStream community to find help at a central location.

- [DeepStream Python Apps](#deepstream-python-apps)
- [Setup](#setup)
- [Python Bindings](#python-bindings)
- [Python Bindings Breaking API Change](#python-bindings-breaking-api-change)
- [Sample Applications](#sample-applications)

## Setup
Once you have DeepStreamSDK pre-requisites and DeepStreamSDK installed on the system, navigate to <DS_ROOT>/sources/ dir which is /opt/nvidia/deepstream/deepstream/sources/ and git clone deepstream_python_apps repo here.

The latest bindings can be installed from [release section](../../releases).
You can also build the bindings from source using the instructions in the [bindings readme](bindings/README.md) if needed.

<a name="metadata_bindings"></a>
## Python Bindings

Expand Down Expand Up @@ -45,13 +51,13 @@ To run the sample applications or write your own, please consult the [HOW-TO Gui

We currently provide the following sample applications:
* [deepstream-test1](apps/deepstream-test1) -- 4-class object detection pipeline, also demonstrates support for new nvstreammux
* **UPDATED** [deepstream-test2](apps/deepstream-test2) -- 4-class object detection, tracking and attribute classification pipeline - now uses new names for tracker meta data types in DS 6.4
* [deepstream-test2](apps/deepstream-test2) -- 4-class object detection, tracking and attribute classification pipeline
* [deepstream-test3](apps/deepstream-test3) -- multi-stream pipeline performing 4-class object detection, also supports triton inference server, no-display mode, file-loop and silent mode
* **UPDATED** [deepstream-test4](apps/deepstream-test4) -- msgbroker for sending analytics results to the cloud - now supports MQTT protocol adaptor
* [deepstream-test4](apps/deepstream-test4) -- msgbroker for sending analytics results to the cloud
* [deepstream-imagedata-multistream](apps/deepstream-imagedata-multistream) -- multi-stream pipeline with access to image buffers
* [deepstream-ssd-parser](apps/deepstream-ssd-parser) -- SSD model inference via Triton server with output parsing in Python
* [deepstream-test1-usbcam](apps/deepstream-test1-usbcam) -- deepstream-test1 pipeline with USB camera input
* **UPDATED** [deepstream-test1-rtsp-out](apps/deepstream-test1-rtsp-out) -- deepstream-test1 pipeline with RTSP output - now demonstrates adding software encoder option to support Jetson Orin Nano
* [deepstream-test1-rtsp-out](apps/deepstream-test1-rtsp-out) -- deepstream-test1 pipeline with RTSP output, demonstrates adding software encoder option to support Jetson Orin Nano
* [deepstream-opticalflow](apps/deepstream-opticalflow) -- optical flow and visualization pipeline with flow vectors returned in NumPy array
* [deepstream-segmentation](apps/deepstream-segmentation) -- segmentation and visualization pipeline with segmentation mask returned in NumPy array
* [deepstream-nvdsanalytics](apps/deepstream-nvdsanalytics) -- multistream pipeline with analytics plugin
Expand Down
15 changes: 11 additions & 4 deletions apps/README
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DeepStream SDK Python Bindings
================================================================================
Setup pre-requisites:
- Ubuntu 22.04
- NVIDIA DeepStream SDK 6.4
- NVIDIA DeepStream SDK 7.0
- Python 3.10
- Gst-python

Expand All @@ -36,7 +36,7 @@ Package Contents
Installing Pre-requisites:
--------------------------------------------------------------------------------

DeepStream SDK 6.4
DeepStream SDK 7.0
--------------------
Download and install from https://developer.nvidia.com/deepstream-download

Expand All @@ -51,16 +51,23 @@ If missing, install with the following steps:
$ sudo apt update
$ sudo apt install python3-gi python3-dev python3-gst-1.0 -y

cuda-python
-----------
$ pip3 install cuda-python

--------------------------------------------------------------------------------
Running the samples
--------------------------------------------------------------------------------
The apps are configured to work from inside the DeepStream SDK 6.4 installation.
The apps are configured to work from inside the DeepStream SDK 7.0 installation.

Clone the deepstream_python_apps repo under <DeepStream ROOT>/sources:
$ git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps
This will create the following directory:
<DeepStream ROOT>/sources/deepstream_python_apps

Cuda python APIs are used to distinguish between iGPU and dGPU.
Install cuda-python using:
pip3 install cuda-python
NOTE: is_aarch64.py is deprecated in favor of platform_info.py
Follow README in each app's directory to run the app.

Example: running test1 app:
Expand Down
25 changes: 0 additions & 25 deletions apps/common/is_aarch_64.py

This file was deleted.

94 changes: 94 additions & 0 deletions apps/common/platform_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

import sys
import platform
from threading import Lock
from cuda import cudart
from cuda import cuda

guard_platform_info = Lock()

class PlatformInfo:
def __init__(self):
self.is_wsl_system = False
self.wsl_verified = False
self.is_integrated_gpu_system = False
self.is_integrated_gpu_verified = False
self.is_aarch64_platform = False
self.is_aarch64_verified = False

def is_wsl(self):
with guard_platform_info:
# Check if its already verified as WSL system or not.
if not self.wsl_verified:
try:
# Open /proc/version file
with open("/proc/version", "r") as version_file:
# Read the content
version_info = version_file.readline()
version_info = version_info.lower()
self.wsl_verified = True

# Check if "microsoft" is present in the version information
if "microsoft" in version_info:
self.is_wsl_system = True
except Exception as e:
print(f"ERROR: Opening /proc/version failed: {e}")

return self.is_wsl_system

def is_integrated_gpu(self):
#Using cuda apis to identify whether integrated/discreet
#This is required to distinguish Tegra and ARM_SBSA devices
with guard_platform_info:
#Cuda initialize
if not self.is_integrated_gpu_verified:
cuda_init_result, = cuda.cuInit(0)
if cuda_init_result == cuda.CUresult.CUDA_SUCCESS:
#Get cuda devices count
device_count_result, num_devices = cuda.cuDeviceGetCount()
if device_count_result == cuda.CUresult.CUDA_SUCCESS:
#If atleast one device is found, we can use the property from
#the first device
if num_devices >= 1:
#Get properties from first device
property_result, properties = cudart.cudaGetDeviceProperties(0)
if property_result == cuda.CUresult.CUDA_SUCCESS:
print("Is it Integrated GPU? :", properties.integrated)
self.is_integrated_gpu_system = properties.integrated
self.is_integrated_gpu_verified = True
else:
print("ERROR: Getting cuda device property failed: {}".format(property_result))
else:
print("ERROR: No cuda devices found to check whether iGPU/dGPU")
else:
print("ERROR: Getting cuda device count failed: {}".format(device_count_result))
else:
print("ERROR: Cuda init failed: {}".format(cuda_init_result))

return self.is_integrated_gpu_system

def is_platform_aarch64(self):
#Check if platform is aarch64 using uname
if not self.is_aarch64_verified:
if platform.uname()[4] == 'aarch64':
self.is_aarch64_platform = True
self.is_aarch64_verified = True
return self.is_aarch64_platform

sys.path.append('/opt/nvidia/deepstream/deepstream/lib')
2 changes: 1 addition & 1 deletion apps/deepstream-custom-binding-test/README
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
################################################################################

Prequisites:
- DeepStreamSDK 6.4
- DeepStreamSDK 7.0
- Python 3.10
- Gst-python

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def main(args):
source.link(h264parser)
h264parser.link(decoder)

sinkpad = streammux.get_request_pad("sink_0")
sinkpad = streammux.request_pad_simple("sink_0")
if not sinkpad:
Gst.error(" Unable to get the sink pad of streammux")

Expand Down
2 changes: 1 addition & 1 deletion apps/deepstream-demux-multi-in-multi-out/README
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
################################################################################

Prerequisites:
- DeepStreamSDK 6.4
- DeepStreamSDK 7.0
- Python 3.10
- Gst-python

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import os
import math
import platform
from common.is_aarch_64 import is_aarch64
from common.platform_info import PlatformInfo
from common.bus_call import bus_call
from common.FPS import PERF_DATA

Expand Down Expand Up @@ -265,6 +265,7 @@ def main(args, requested_pgie=None, config=None, disable_probe=False):
global perf_data
perf_data = PERF_DATA(number_sources)

platform_info = PlatformInfo()
# Standard GStreamer initialization
Gst.init(None)

Expand Down Expand Up @@ -294,7 +295,7 @@ def main(args, requested_pgie=None, config=None, disable_probe=False):
sys.stderr.write("Unable to create source bin \n")
pipeline.add(source_bin)
padname = "sink_%u" % i
sinkpad = streammux.get_request_pad(padname)
sinkpad = streammux.request_pad_simple(padname)
if not sinkpad:
sys.stderr.write("Unable to create sink pad bin \n")
srcpad = source_bin.get_static_pad("src")
Expand Down Expand Up @@ -347,14 +348,18 @@ def main(args, requested_pgie=None, config=None, disable_probe=False):
for i in range(number_sources):
# pipeline nvstreamdemux -> queue -> nvvidconv -> nvosd -> (if Jetson) nvegltransform -> nveglgl
# Creating EGLsink
if is_aarch64():
if platform_info.is_integrated_gpu():
print("Creating nv3dsink \n")
sink = make_element("nv3dsink", i)
if not sink:
sys.stderr.write(" Unable to create nv3dsink \n")
else:
print("Creating EGLSink \n")
sink = make_element("nveglglessink", i)
if platform_info.is_platform_aarch64():
print("Creating nv3dsink \n")
sink = make_element("nv3dsink", i)
else:
print("Creating EGLSink \n")
sink = make_element("nveglglessink", i)
if not sink:
sys.stderr.write(" Unable to create egl sink \n")
pipeline.add(sink)
Expand All @@ -375,7 +380,7 @@ def main(args, requested_pgie=None, config=None, disable_probe=False):

# connect nvstreamdemux -> queue
padname = "src_%u" % i
demuxsrcpad = nvstreamdemux.get_request_pad(padname)
demuxsrcpad = nvstreamdemux.request_pad_simple(padname)
if not demuxsrcpad:
sys.stderr.write("Unable to create demux src pad \n")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ gpu-id=0
net-scale-factor=0.00392156862745098
tlt-model-key=tlt_encode
tlt-encoded-model=../../../../samples/models/Primary_Detector/resnet18_trafficcamnet.etlt
model-engine-file=../../../../samples/models/Primary_Detector/resnet18_trafficcamnet.etlt_b1_gpu0_int8.engine
model-engine-file=../../../../samples/models/Primary_Detector/resnet18_trafficcamnet.etlt_b30_gpu0_int8.engine
labelfile-path=../../../../samples/models/Primary_Detector/labels.txt
int8-calib-file=../../../../samples/models/Primary_Detector/cal_trt.bin
force-implicit-batch-dim=1
Expand Down
2 changes: 1 addition & 1 deletion apps/deepstream-imagedata-multistream-cupy/README
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
################################################################################

Prerequisites:
- DeepStreamSDK 6.4
- DeepStreamSDK 7.0
- Python 3.10
- Gst-python
- NumPy package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from ctypes import *
import sys
import math
from common.is_aarch_64 import is_aarch64
from common.platform_info import PlatformInfo
from common.bus_call import bus_call
from common.FPS import PERF_DATA
import pyds
Expand Down Expand Up @@ -237,7 +237,7 @@ def main(args):
sys.stderr.write("Unable to create source bin \n")
pipeline.add(source_bin)
padname = "sink_%u" % i
sinkpad = streammux.get_request_pad(padname)
sinkpad = streammux.request_pad_simple(padname)
if not sinkpad:
sys.stderr.write("Unable to create sink pad bin \n")
srcpad = source_bin.get_static_pad("src")
Expand Down Expand Up @@ -273,8 +273,13 @@ def main(args):
if not nvosd:
sys.stderr.write(" Unable to create nvosd \n")

print("Creating EGLSink \n")
sink = Gst.ElementFactory.make("nveglglessink", "nvvideo-renderer")

if platform_info.is_platform_aarch64():
print("Creating nv3dsink \n")
sink = Gst.ElementFactory.make("nv3dsink", "nv3d-sink")
else:
print("Creating EGLSink \n")
sink = Gst.ElementFactory.make("nveglglessink", "nvvideo-renderer")
if not sink:
sys.stderr.write(" Unable to create egl sink \n")

Expand Down Expand Up @@ -370,8 +375,9 @@ def parse_args():


if __name__ == '__main__':
if is_aarch64():
sys.stderr.write ("\nThis app is not currently supported on aarch64. Exiting...\n\n\n\n")
platform_info = PlatformInfo()
if platform_info.is_integrated_gpu():
sys.stderr.write ("\nThis app is not currently supported on integrated GPU. Exiting...\n\n\n\n")
sys.exit(1)
stream_paths = parse_args()
sys.exit(main(stream_paths))
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ gpu-id=0
net-scale-factor=0.00392156862745098
tlt-model-key=tlt_encode
tlt-encoded-model=../../../../samples/models/Primary_Detector/resnet18_trafficcamnet.etlt
model-engine-file=../../../../samples/models/Primary_Detector/resnet18_trafficcamnet.etlt_b1_gpu0_int8.engine
model-engine-file=../../../../samples/models/Primary_Detector/resnet18_trafficcamnet.etlt_b30_gpu0_int8.engine
labelfile-path=../../../../samples/models/Primary_Detector/labels.txt
int8-calib-file=../../../../samples/models/Primary_Detector/cal_trt.bin
force-implicit-batch-dim=1
Expand Down
2 changes: 1 addition & 1 deletion apps/deepstream-imagedata-multistream-redaction/README
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
################################################################################

Prerequisites:
- DeepStreamSDK 6.4
- DeepStreamSDK 7.0
- Python 3.10
- Gst-python
- NumPy package
Expand Down
Loading

0 comments on commit 216ce3a

Please sign in to comment.