官方文档链接:https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Overview.html#deepstream-graph-architecture
DeepSream提供超过15种以上的GStreamer插件模块,以此建造一个高效的视频分析管道(Pipeline)。
1. 视频流,可以是本地文件、RTSP流或者直接通过camera相机,流的获取是通过CPU的。帧(frames)在缓存(memary)通过NVDEC算子来解码(decode),用到Gst-nvvideo4linux2插件。
2. 解码,可以选择图像的预处理,预处理包括图像矫正(dewap)、颜色空间转换(BGR2GRAY),分别用到Gst-nvdewarper插件和Gst-nvvideoconvert插件,他们都是在GPU进行的。
3. 批处理帧,用到Gst-nvstreammux插件。
4. 推理,批处理完的帧后进行推理,使用TensorRT、NVIDIA的实时推理加速用到本地的TensorFlow或者pytorch框架上。TensorRT推理用到Gst-nvinfer插件,Triton推理用到Gst-nvinferserver 插件,推理过程用到GPU或者DLA(Deep Learning accelerator)在Jetson AGX Xavier and Xavier NX上。
5. 目标跟踪,推理完之后使用目标跟踪,在SDK中有几个内置的跟踪器,表现还是很棒的,用到的插件是Gst-nvtracker。
6. 可视化构件,目标跟踪后,创建可视化构件,比如包围框、分割的掩膜和标签。可视化用到Gst-nvdsosd插件。
7、输出,DeepStream提供多种输出方式,可以直接渲染(render)包围框在屏幕上,也可以保存到本地磁盘,也可以输出RTSP视频流、也可以发送数据到云端。Gst-nvmsgconv插件提供输出负载,Gst-nvmsgbroker插件提供连接云端。
deepstream-test1:单路视频和产生包围框
deepstream-test2:基于test1添加了检测对象的分类
deepstream-test3:基于test1添加多路视频的输入
deepstream-test4:基于test1添加了loT的连接插件nvmsgbroker plugin
更多样例:
C++样例:C/C++ Sample Apps Source Details
Python样例:Python Sample Apps Source Details
C++样例中test5:
目录:apps/sample_apps/deepstream-test5
说明:
新增了能够连接云端和输入RTSP流的功能。
Use of Gst-nvmsgconv and Gst-nvmsgbroker plugins in the pipeline for multistream
How to configure Gst-nvmsgbroker plugin from the config file as a sink plugin (for KAFKA, Azure, etc.)
How to handle the RTCP sender reports from RTSP servers or cameras and translate the Gst Buffer PTS to a UTC timestamp.
For more details refer the RTCP Sender Report callback function test5_rtcp_sender_report_callback()
registration and usage in deepstream_test5_app_main.c
. GStreamer callback registration with rtpmanager element’s “handle-sync” signal is documented in apps-common/src/deepstream_source_bin.c
输出RTSP流
1.deepstream-test1-rtsp-out
目录:apps/deepstream-test1-rtsp-out
说明:Simple test application 1 modified to output visualization stream over RTSP.
2. deepstream-test4
目录:apps/deepstream-test4
说明:
Builds on deepstream-test1 for a single H.264 stream: filesrc, decode, nvstreammux, nvinfer, nvdsosd, renderer to demonstrate how to:
Use the Gst-nvmsgconv and Gst-nvmsgbroker plugins in the pipeline
Create NVDS_META_EVENT_MSG type metadata and attach it to the buffer
Use NVDS_META_EVENT_MSG for different types of objects, e.g. vehicle and person
Implement “copy” and “free” functions for use if metadata is extended through the extMsg field