# DeepStream python bindings
SDK version supported: 6.4
The latest prebuilt release package complete with python bindings and sample applications can be downloaded from the [release section](../../../releases)
for both x86 and Jetson platforms.
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.
The readme is divided into three main parts:
- [DeepStream python bindings](#deepstream-python-bindings)
- [1 Prerequisites](#1-prerequisites)
- [1.1 Deepstream SDK](#11-deepstream-sdk)
- [1.2 Base dependencies](#12-base-dependencies)
- [1.3 Initialization of submodules](#13-initialization-of-submodules)
- [1.4 Installing Gst-python](#14-installing-gst-python)
- [2 Compiling the bindings](#2-compiling-the-bindings)
- [2.1 Quick build (x86-ubuntu-22.04 | python 3.10 | Deepstream 6.4)](#21-quick-build-x86-ubuntu-2204--python-310--deepstream-64)
- [2.2 Advanced build](#22-advanced-build)
- [2.2.1 Using Cmake options](#221-using-cmake-options)
- [2.2.2 Available cmake options](#222-available-cmake-options)
- [2.2.3 Example](#223-example)
- [2.3 Cross-Compilation for aarch64 on x86](#23-cross-compilation-for-aarch64-on-x86)
- [2.3.1 Build Pre-requisites](#231-build-pre-requisites)
- [2.3.2 Download the JetPack SDK 6.0 DP](#232-download-the-jetpack-sdk-60-dp)
- [2.3.3 Generate the cross-compile build container](#233-generate-the-cross-compile-build-container)
- [2.3.4 Launch the cross-compile build container](#234-launch-the-cross-compile-build-container)
- [2.3.5 Build DeepStreamSDK python bindings](#235-build-deepstreamsdk-python-bindings)
- [3 Installing the bindings](#3-installing-the-bindings)
- [3.1 Installing the pip wheel](#31-installing-the-pip-wheel)
- [3.1.1 pip wheel troubleshooting](#311-pip-wheel-troubleshooting)
- [3.2 Launching test-1 app](#32-launching-test-1-app)
<a name="prereqs"></a>
## 1 Prerequisites
The following dependencies need to be met in order to compile bindings:
<a name="prereq_ds"></a>
### 1.1 Deepstream SDK
Go to https://developer.nvidia.com/deepstream-sdk, download and install Deepstream SDK and its dependencies
<a name="prereq_base"></a>
### 1.2 Base dependencies
To compile bindings on Ubuntu - 22.04 [use python-3.10, python-3.8 will not work] :
```
apt install python3-gi python3-dev python3-gst-1.0 python-gi-dev git meson \
python3 python3-pip python3.10-dev cmake g++ build-essential libglib2.0-dev \
libglib2.0-dev-bin libgstreamer1.0-dev libtool m4 autoconf automake libgirepository1.0-dev libcairo2-dev
```
<a name="prereq_init_sub"></a>
### 1.3 Initialization of submodules
Make sure you 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
```
The repository utilizes gst-python and pybind11 submodules.
To initializes them, run the following command:
```bash
cd /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/
git submodule update --init
```
<a name="prereq_install_gst"></a>
### 1.4 Installing Gst-python
Following commands ensure we add the new certificates that gst-python git server now uses:
```bash
sudo apt-get install -y apt-transport-https ca-certificates -y
sudo update-ca-certificates
```
Build and install gst-python:
```bash
cd 3rdparty/gstreamer/subprojects/gst-python/
meson build
meson configure
cd build
ninja
ninja install
```
<a name="compile_bindings"></a>
## 2 Compiling the bindings
Python bindings are compiled using CMake.
Following commands provide quick cmake configurations for common compilation options:
<a name="compile_quick"></a>
### 2.1 Quick build (x86-ubuntu-22.04 | python 3.10 | Deepstream 6.4)
```bash
cd deepstream_python_apps/bindings
mkdir build
cd build
cmake ..
make -j$(nproc)
```
<a name="compile_advance"></a>
### 2.2 Advanced build
#### 2.2.1 Using Cmake options
Multiple options can be used with cmake as follows:
```bash
cmake .. [-D<var>=<value> [-D<var>=<value> [-D<var>=<value> ... ]]]
```
#### 2.2.2 Available cmake options
| Var | Default value | Purpose | Available values
|-----|:-------------:|---------|:----------------:
| DS_VERSION | 6.4 | Used to determine default deepstream library path | should match to the deepstream version installed on your computer
| PYTHON_MAJOR_VERSION | 3 | Used to set the python version used for the bindings | 3
| PYTHON_MINOR_VERSION | 10 | Used to set the python version used for the bindings | 10
| PIP_PLATFORM | linux_x86_64 | Used to select the target architecture to compile the bindings | linux_x86_64, linux_aarch64
| DS_PATH | /opt/nvidia/deepstream/deepstream-${DS_VERSION} | Path where deepstream libraries are available | Should match the existing deepstream library folder
#### 2.2.3 Example
Following commands can be used to compile the bindings natively on Jetson devices
```bash
cd deepstream_python_apps/bindings
mkdir build
cd build
cmake .. -DPYTHON_MAJOR_VERSION=3 -DPYTHON_MINOR_VERSION=10 \
-DPIP_PLATFORM=linux_aarch64 -DDS_PATH=/opt/nvidia/deepstream/deepstream/
make
```
<a name="compile_cross"></a>
### 2.3 Cross-Compilation for aarch64 on x86
This section outlines how to enable cross-compiling of the DeepStreamSDK python bindings for aarch64 using Docker on x86 host.
NOTE: This will only emulate the CPU, so any calls requiring embedded hardware, such as using CUDA or inference are not supported.
#### 2.3.1 Build Pre-requisites
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:
```bash
# Install qemu packages
sudo apt-get install qemu binfmt-support qemu-user-static
# Execute the registering scripts
docker run --rm --privileged dockerhub.nvidia.com/multiarch/qemu-user-static --reset -p yes
# Verify qemu installation
docker run --platform linux/aarch64 --rm -t nvcr.io/nvidia/deepstream:6.4-samples-multiarch uname -m
#aarch64
```
#### 2.3.2 Download the JetPack SDK 6.0 DP
Cross-compilation for Jetson on x86 host requires some low level libraries which can be downloaded using SDK Manager.
Follow these steps to obtain these libraries, which are utilized by the docker build later.
1. Download and install the [NVIDIA SDK manager](https://developer.nvidia.com/nvidia-sdk-manager)
2. Launch the SDK Manager and login with your NVIDIA developer account.
3. Select the platform and target OS (example: Jetson AGX Xavier, `Linux Jetpack 6.0 DP`) and click Continue.
4. Under `Download & Install Options` change the download folder and select `Download now, Install later`. Agree to the license terms and click Continue.
5. Go to the download folder, and run:
```bash
# create directories as follows:
mkdir -p deepstream_python_apps/bindings/docker/jetpack_files
# <path/to> would be /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/
# where you downloaded the deepstream_python_apps repository
mv ~/Downloads/nvidia/sdkm_downloads/* <path/to>/deepstream_python_apps/bindings/docker/jetpack_files
```
#### 2.3.3 Generate the cross-compile build container
Below command generates the build container
```bash
# cd to bindings dir
cd deepstream_python_apps/bindings
# Make sure you are in deepstream_python_apps/bindings directory
# This command builds the cross-compile docker and adds the mentioned tag
docker build --platform linux/aarch64 --tag=deepstream-6.4-ubuntu22.04-python-l4t -f qemu_docker/ubuntu-cross-aarch64.Dockerfile .
```
#### 2.3.4 Launch the cross-compile build container
```bash
# Create a directory to mount to the container and store your pyds wheel package in
mkdir export_pyds
# Run the
没有合适的资源?快使用搜索试试~ 我知道了~
deepstream-python-apps-master.zip
共206个文件
txt:50个
py:43个
readme:20个
0 下载量 157 浏览量
2024-01-26
14:59:30
上传
评论
收藏 7.71MB ZIP 举报
温馨提示
包含DeepStream SDK的Python绑定接口及示例应用程序。
资源推荐
资源详情
资源评论
收起资源包目录
deepstream-python-apps-master.zip (206个子文件)
make.bat 795B
bindfunctions.cpp 31KB
bindschema.cpp 29KB
bindnvdsmeta.cpp 27KB
bindnvbufsurface.cpp 23KB
bindnvosd.cpp 20KB
bindnvdsinfer.cpp 12KB
bindtrackermeta.cpp 5KB
utils.cpp 4KB
bindcustom.cpp 3KB
bindgstnvdsmeta.cpp 3KB
bindanalyticsmeta.cpp 3KB
bindmeta360.cpp 3KB
bindopticalflow.cpp 3KB
pyds.cpp 2KB
custom.css 5KB
ubuntu-cross-aarch64.Dockerfile 2KB
.gitmodules 205B
functionsdoc.h 33KB
nvdsmetadoc.h 23KB
schemadoc.h 18KB
nvosddoc.h 16KB
nvbufsurfacedoc.h 13KB
nvdsinferdoc.h 12KB
trackermetadoc.h 7KB
analyticsmetadoc.h 6KB
opticalflowdoc.h 5KB
bind_string_property_definitions.h 3KB
gstnvdsmetadoc.h 2KB
meta360doc.h 2KB
customdoc.h 1KB
nvds_360d_meta.h 1KB
utils.hpp 6KB
pyds.hpp 2KB
bindfunctions.hpp 1KB
bindanalyticsmeta.hpp 970B
bindcustom.hpp 945B
bindschema.hpp 919B
bindopticalflow.hpp 890B
bindtrackermeta.hpp 887B
bindnvbufsurface.hpp 886B
bindgstnvdsmeta.hpp 882B
bindnvdsinfer.hpp 876B
bindnvosd.hpp 875B
bindmeta360.hpp 875B
bindnvdsmeta.hpp 873B
custom_data.hpp 824B
Nvidia.ico 147KB
favicon.ico 15KB
deepstream_test_1.ipynb 3.8MB
deepstream_launchpad.ipynb 68KB
deepstream_test_4.ipynb 30KB
pk_scripts.js 580B
LICENSE 660B
Makefile 634B
BINDINGSGUIDE.md 39KB
CUSTOMUSERMETAGUIDE.md 13KB
HOWTO.md 10KB
custom_parser_guide.md 10KB
README.md 10KB
FAQ.md 9KB
README.md 6KB
README.md 2KB
README.md 631B
config.pbtxt 1KB
ds_test1.png 2.74MB
.test3-app.png 1.03MB
.python-app-pipeline.png 309KB
ds_workflow.png 238KB
nv_logo.png 103KB
ds_launchpad_pipeline.png 69KB
imagedata-app-block-diagram.png 46KB
imagedata-app-block-diagram.png 46KB
deepstream_imagedata-multistream_redaction.py 19KB
deepstream_rt_src_add_del.py 17KB
deepstream_imagedata-multistream.py 17KB
deepstream_test_3.py 17KB
deepstream_test_4.py 17KB
deepstream_nvdsanalytics.py 17KB
deepstream_ssd_parser.py 17KB
deepstream_demux_multi_in_multi_out.py 16KB
deepstream_segmask.py 16KB
deepstream_preprocess_test.py 16KB
deepstream-opticalflow.py 15KB
deepstream_imagedata-multistream_cupy.py 14KB
deepstream_test1_rtsp_in_rtsp_out.py 14KB
deepstream_test_2.py 13KB
deepstream_test1_rtsp_out.py 13KB
deepstream_test_1_usb.py 11KB
deepstream_segmentation.py 10KB
deepstream_test_1.py 10KB
deepstream_custom_binding_test.py 7KB
test.py 7KB
ssd_parser.py 6KB
deepstream_demo.py 5KB
parse_bindings.py 4KB
generic_pipeline.py 4KB
pipeline_filesink.py 4KB
conf.py 4KB
nms.py 4KB
共 206 条
- 1
- 2
- 3
资源评论
神气仙人
- 粉丝: 2073
- 资源: 101
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功