deepstream-nvdsanalytics
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
################################################################################ # Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. # # 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: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # 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. ################################################################################ Prerequisites: - DeepStreamSDK 5.1 - Python 3.6 - Gst-python To run: $ python3 deepstream_nvdsanalytics.py <uri1> [uri2] ... [uriN] e.g. $ python3 deepstream_nvdsanalytics.py file:///home/ubuntu/video1.mp4 file:///home/ubuntu/video2.mp4 $ python3 deepstream_nvdsanalytics.py rtsp://127.0.0.1/video1 rtsp://127.0.0.1/video2 This document describes the sample deepstream-nvdsanalytics application. This sample builds on top of the deepstream-test3 sample to demonstrate how to: * Use multiple sources in the pipeline. * Use a uridecodebin so that any type of input (e.g. RTSP/File), any GStreamer supported container format, and any codec can be used as input. * Configure the stream-muxer to generate a batch of frames and infer on the batch for better resource utilization. * Configure the tracker (referred to as nvtracker in this sample) uses config file dsnvanalytics_tracker_config.txt * Configure the nvdsanalytics plugin (referred to as nvanalytics in this sample) uses config file config_nvdsanalytics.txt * Extract the stream metadata, which contains useful information about the objects and frames in the batched buffer. This sample accepts one or more H.264/H.265 video streams as input. It creates a source bin for each input and connects the bins to an instance of the "nvstreammux" element, which forms the batch of frames. The batch of frames is fed to "nvinfer" for batched inferencing. The batched buffer is used as input for "nvtracker" which adds object tracking, which is then fed into "nvdsanalytics" element which runs analytics algorithms on these objects. This output is then composited into a 2D tile array using "nvmultistreamtiler." The rest of the pipeline is similar to the deepstream-test3 sample. The "width" and "height" properties must be set on the stream-muxer to set the output resolution. If the input frame resolution is different from stream-muxer's "width" and "height", the input frame will be scaled to muxer's output resolution. The stream-muxer waits for a user-defined timeout before forming the batch. The timeout is set using the "batched-push-timeout" property. If the complete batch is formed before the timeout is reached, the batch is pushed to the downstream element. If the timeout is reached before the complete batch can be formed (which can happen in case of rtsp sources), the batch is formed from the available input buffers and pushed. Ideally, the timeout of the stream-muxer should be set based on the framerate of the fastest source. It can also be set to -1 to make the stream-muxer wait infinitely. The "nvmultistreamtiler" composite streams based on their stream-ids in row-major order (starting from stream 0, left to right across the top row, then across the next row, etc.).