Skip to content

Commit

Permalink
Update to 1.1.0 release
Browse files Browse the repository at this point in the history
- Add bindings sources and build instructions
- Update license to Apache 2.0
- New bindings and apps
  • Loading branch information
nv-zhliu committed Oct 27, 2021
1 parent 6aabcaf commit b362b17
Show file tree
Hide file tree
Showing 146 changed files with 11,715 additions and 1,177 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "3rdparty/pybind11"]
path = 3rdparty/pybind11
url = https://github.com/pybind/pybind11.git
[submodule "3rdparty/gst-python"]
path = 3rdparty/gst-python
url = https://github.com/GStreamer/gst-python.git
29 changes: 22 additions & 7 deletions FAQ.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Frequently Asked Questions and Troubleshooting Guide

* [Git clone fails due to Gstreamer repo access error](#faq9)
* [Application fails to work with mp4 stream](#faq0)
* [Ctrl-C does not stop the app during engine file generation](#faq1)
* [Application fails to create gst elements](#faq2)
Expand All @@ -8,7 +9,21 @@
* [Error on setting string field](#faq5)
* [Pipeline unable to perform at real time](#faq6)
* [Triton container problems with multi-GPU setup](#faq7)
* [ModuleNotFoundError: No module named 'pyds'] (#faq8)
* [ModuleNotFoundError: No module named 'pyds'](#faq8)

<a name="faq9"></a>
### Git clone fails due to Gstreamer repo access error
If the following error is encountered while cloning:
```
fatal: unable to access 'https://gitlab.freedesktop.org/gstreamer/common.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
fatal: clone of 'https://gitlab.freedesktop.org/gstreamer/common.git' into submodule path '/opt/nvidia/deepstream/deepstream/sources/ds_python/3rdparty/gst-python/common' failed
```

Temporarily disable git SSL verification by:
```
export GIT_SSL_NO_VERIFY=true
```
before cloning the repo. Unset the variable after cloning.

<a name="faq0"></a>
### Application fails to work with mp4 stream
Expand Down Expand Up @@ -106,9 +121,9 @@ e.g.: `--gpus device=0`

<a name="faq8"></a>
### ModuleNotFoundError: No module named 'pyds'
The pyds extension is installed under /opt/nvidia/deepstream/deepstream/lib
The sample applications all include this path via the is_aarch_64 module.
A setup.py is also provided to install this extension into standard path.
Currently this needs to be run manually:
$ cd /opt/nvidia/deepstream/deepstream/lib
$ python3 setup.py install
The pyds wheel installs the pyds.so library where all the pip packages are stored. Make sure the wheel installation succeeds and the pyds.so is present in the correct path (which should be /home/<user>/.local/lib/python<python-version>/site-packages/pyds.so)

Command to install the pyds wheel is:
```bash
$ pip3 install ./pyds-1.1.0-py3-none*.whl
```
19 changes: 13 additions & 6 deletions HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ This guide provides resources for DeepStream application development in Python.
## Prerequisites

* Ubuntu 18.04
* [DeepStream SDK 5.1](https://developer.nvidia.com/deepstream-download) or later
* Python 3.6
* [DeepStream SDK 6.0](https://developer.nvidia.com/deepstream-download) or later
* Python 3.6+
* [Gst Python](https://gstreamer.freedesktop.org/modules/gst-python.html) v1.14.5

Gst python should be already installed on Jetson.
Expand All @@ -35,14 +35,21 @@ If missing, install with the following steps:
$ sudo make install
```

<a name="compile_bindings"></a>
## Compiling Python Bindings

Please follow instructions for compiling the bindings [here](bindings/README.md)

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

<a name="run_samples"></a>
## Running Sample Applications

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

This will create the following directory:
```<DeepStream 5.1 ROOT>/sources/deepstream_python_apps```
```<DeepStream 6.0 ROOT>/sources/deepstream_python_apps```

The Python apps are under the "apps" directory.
Go into each app directory and follow instructions in the README.
Expand All @@ -60,7 +67,7 @@ See [sample applications](apps/) main functions for pipeline construction exampl

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/dev-guide/text/DS_plugin_metadata.html) and [API Guide](https://docs.nvidia.com/metropolis/deepstream/python-api/index.html).

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.
The SDK MetaData library is developed in C/C++. Python bindings provide access to the MetaData from Python applications. The bindings are provided as part of this repository [here](bindings) and can be compiled natively for x86_64 and Jetson platforms. This module, pyds.so, can also be cross-compiled for aarch64 on x86 host by using [Qemu](https://www.qemu.org/) emulator. Dockerfile for the cross-compilation is provided [here](bindings/qemu_docker/ubuntu-cross-aarch64.Dockerfile)

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:
cd /opt/nvidia/deepstream/deepstream/lib
Expand Down Expand Up @@ -204,5 +211,5 @@ This function populates the input buffer with a timestamp generated according to
<a name="imagedata_access"></a>
## Image Data Access

Decoded images are accessible as NumPy arrays via the `get_nvds_buf_surface` function. This function is documented in the [API Guide](https://docs.nvidia.com/metropolis/deepstream/5.1/python-api/index.html).
Decoded images are accessible as NumPy arrays via the `get_nvds_buf_surface` function. This function is documented in the [API Guide](https://docs.nvidia.com/metropolis/deepstream/6.0/python-api/index.html).
Please see the [deepstream-imagedata-multistream](apps/deepstream-imagedata-multistream) sample application for an example of image data usage.
28 changes: 11 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
MIT License
SPDX-FileCopyrightText: Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0

Copyright (c) 2019 - 2021 NVIDIA CORPORATION. All rights reserved.
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

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
http://www.apache.org/licenses/LICENSE-2.0

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@

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

SDK version supported: 5.1
SDK version supported: 6.0

<b>NEW: The bindings sources along with build instructions are now available under [bindings](bindings)! </b>

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

Please report any issues or bugs on the [Deepstream SDK Forums](https://devtalk.nvidia.com/default/board/209).
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.

* [Python Bindings](#metadata_bindings)
* [Sample Applications](#sample_applications)
- [DeepStream Python Apps](#deepstream-python-apps)
- [Python Bindings](#python-bindings)
- [Sample Applications](#sample-applications)

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

DeepStream pipelines can be constructed using Gst Python, the GStreamer framework's Python bindings. For accessing DeepStream MetaData,
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).
Python [bindings](bindings) are provided as part of this repository. This module is generated using [Pybind11](https://github.com/pybind/pybind11).

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

These bindings support a Python interface to the MetaData structures and functions. Usage of this interface is documented in the [HOW-TO Guide](HOWTO.md) and demonstrated in the sample applications.
This release adds bindings for decoded image buffers (NvBufSurface) as well as inference output tensors (NvDsInferTensorMeta).

<a name="sample_applications"></a>
## Sample Applications
Expand All @@ -46,12 +48,12 @@ We currently provide the following sample applications:
* [deepstream-test1-usbcam](apps/deepstream-test1-usbcam) -- deepstream-test1 pipelien with USB camera input
* [deepstream-test1-rtsp-out](apps/deepstream-test1-rtsp-out) -- deepstream-test1 pipeline with RTSP output
* [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
* [runtime_source_add_delete](apps/runtime_source_add_delete) -- add/delete source streams at runtime
* [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
* [runtime_source_add_delete](apps/runtime_source_add_delete) -- add/delete source streams at runtime
* [deepstream-imagedata-multistream-redaction](apps/deepstream-imagedata-multistream-redaction) -- multi-stream pipeline with face detection and redaction (<b>NEW</b>)
* [deepstream-rtsp-in-rtsp-out](apps/deepstream-rtsp-in-rtsp-out) -- multi-stream pipeline with RTSP input/output (<b>NEW</b>)

Of these applications, the following have been updated or added in this release:
* runtime_source_add_delete -- add/delete source streams at runtime

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

Expand Down
37 changes: 16 additions & 21 deletions apps/README
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
################################################################################
# Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
# 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
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# http://www.apache.org/licenses/LICENSE-2.0
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# 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.
################################################################################

================================================================================
DeepStream SDK Python Bindings
================================================================================
Setup pre-requisites:
- Ubuntu 18.04
- NVIDIA DeepStream SDK 5.1
- NVIDIA DeepStream SDK 6.0
- Python 3.6
- Gst-python

Expand Down Expand Up @@ -63,7 +58,7 @@ The DeepStream Python package includes:
Installing Pre-requisites:
--------------------------------------------------------------------------------

DeepStream SDK 5.1 Developer Preview
DeepStream SDK 6.0
--------------------
Download and install from https://developer.nvidia.com/deepstream-download

Expand All @@ -81,12 +76,12 @@ $ sudo apt install python3-gi python3-dev python3-gst-1.0 -y
--------------------------------------------------------------------------------
Running the samples
--------------------------------------------------------------------------------
The apps are configured to work from inside the DeepStream SDK 5.1 installation.
The apps are configured to work from inside the DeepStream SDK 6.0 installation.

Clone the deepstream_python_apps repo under <DeepStream 5.1 ROOT>/sources:
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 5.1 ROOT>/sources/deepstream_python_apps
<DeepStream ROOT>/sources/deepstream_python_apps

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

Expand Down
27 changes: 11 additions & 16 deletions apps/common/FPS.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
################################################################################
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
# 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
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# http://www.apache.org/licenses/LICENSE-2.0
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# 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 time
Expand Down
27 changes: 11 additions & 16 deletions apps/common/bus_call.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
################################################################################
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
# 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
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# http://www.apache.org/licenses/LICENSE-2.0
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# 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 gi
Expand Down
Loading

0 comments on commit b362b17

Please sign in to comment.