Gst-nvdsanalytics =================== This plugin performs analytics on metadata attached by ``nvinfer`` (primary detector) and ``nvtracker``. Analytics refer to Region of Interest (ROI) Filtering, Overcrowding Detection, Direction Detection and Line Crossing. The plugin operates in batch mode, it handles the context for each stream independently. ROI based analytics work on primary detector output, but Direction Detection and Line Crossing requires a tracker-id as previous history/state is required to do both the analytics. The configuration for the rules for analytics is achieved using a configuration file. The ``gst-nvdsanalytics`` plugin extracts the metadata from the batched buffer sent by the upstream (``nvtracker/nvinfer``) element and passes it to the low-level ``nvdsanalytics`` library. The low-level library performs analytics based on the configured rules for each feature for each of the streams, the library returns the analytics output, which is for each tracked object as well for the complete frame. The analytics output (Frame level) is encapsulated in the ``NvDsAnalyticsFrameMeta`` structure and is added as user meta with meta_type set to ``NVDS_USER_FRAME_META_NVDSANALYTICS``.The user meta is added to the ``frame_user_meta_list`` member of ``NvDsFrameMeta``. The analytics output (per detected Object) is encapsulated in the ``NvDsAnalyticsObjInfo`` structure and is added as user meta with meta_type set to ``NVDS_USER_OBJ_META_NVDSANALYTICS``. The user meta is added to the obj_user_meta_list member of ``NvDsObjectMeta``. The definition of ``NvDsAnalyticsObjInfo`` ``NvDsAnalyticsFrameMeta`` is available in ``sources/includes/nvds_analytics_meta.h`` header file. For guidance on how to access user metadata, see User/Custom Metadata Addition Inside NvDsBatchMeta and Tensor Metadata. .. image:: /content/DS_plugin_gst-nvdsanalytics.png :align: center :alt: Gst-nvdsanalytics Inputs and Outputs ------------------- * Inputs * GStreamer buffer containing NV12/RGBA frame(s) with attached metadata * Control Parameters * enable: True Enables the plugin, False sets it in pass-through mode * config-file: Configuration file which consist of the analytics rules * Output * Original NV12/RGBA batched buffer * ``NvDsAnalyticsFrameMeta`` (meta containing information about individual frames in the batched buffer) * ``NvDsAnalyticsObjInfo`` (meta containing information about individual objects in the individual frames of batched buffer) Features --------- The following table summarizes the features of the plugin. .. csv-table:: Gst-nvdsanalytics plugin features :file: ../content/tables/Gst-nvdsanalytics tables/DS_Plugin_gst-nvdsanalytics_features.csv :widths: 30, 30, 30 :header-rows: 1 Gst Properties --------------- The following table describes the Gst properties of the Gst-nvdsanalytics plugin. .. csv-table:: Gst-nvdsanalytics plugin gst properties :file: ../content/tables/Gst-nvdsanalytics tables/DS_Plugin_gst-nvdsanalytics_gst-properties.csv :widths: 25, 25, 25, 25 :header-rows: 1 Configuration File Parameters ------------------------------- The Gst-nvdsanalytics configuration file uses a “Key File” format described in: https://specifications.freedesktop.org/desktop-entry-spec/latest * The ``[property]`` group configures the general behavior of the plugin. It is the only mandatory group. * The ``[roi-filtering-stream-]`` group configures ROI filtering rules parameters for stream specified by . For example, classes. [roi-filtering-stream-0] configures ROI filtering rules for stream ID 0. * The ``[overcrowding-]`` group configures Overcrowding parameters for a stream specified by . * The ``[direction-detection-]`` group configures Direction Detection parameters for a stream specified by . * The ``[line-crossing-]`` group configures Line Crossing parameters for a stream specified by . The following table respectively describe the keys supported for ``[property]`` groups and ``[-stream-]`` groups. .. csv-table:: Gst-nvdsanalytics plugin gst properties :file: ../content/tables/Gst-nvdsanalytics tables/DS_Plugin_gst-nvdsanalytics_config_parameters.csv :widths: 20, 20, 20, 20, 20 :header-rows: 1 .. note:: The config-width, config-height, indicate the resolution at which analytics rules have been configured. If the runtime stream resolution is different than the configuration resolution. The plugin handles the resolution change and scales the rules for the runtime resolution. The configuration rules are not present in absolute pixel values. The following pipelines demonstrate plugin’s usage. * For dGPU: :: gst-launch-1.0 filesrc location=streams/sample_1080p.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! m.sink_0 nvstreammux name=m width=1920 height=1080 batch-size=1 live-source=1 ! nvinfer config-file-path= config_infer_primary.txt ! nvtracker ll-lib-file = /opt/nvidia/deepstream/deepstream/lib/libnvds_nvdcf.so ll-config-file= tracker_config.yml tracker-width=640 tracker-height=384 ! nvdsanalytics config-file= config_nvdsanalytics.txt ! nvmultistreamtiler ! nvvideoconvert ! nvdsosd ! nveglglessink * For Jetson: :: gst-launch-1.0 filesrc location=streams/sample_1080p.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! m.sink_0 nvstreammux name=m width=1920 height=1080 batch-size=1 live-source=1 ! nvinfer config-file-path= config_infer_primary.txt ! nvtracker ll-lib-file = /opt/nvidia/deepstream/deepstream/lib/libnvds_nvdcf.so ll-config-file= tracker_config.yml tracker-width=640 tracker-height=384 ! nvdsanalytics config-file= config_nvdsanalytics.txt ! nvmultistreamtiler ! nvvideoconvert ! nvdsosd ! nvegltransform ! nveglglessink The configuration files are located at ``sources/apps/sample_apps/deepstream-nvdsanalytics-test/config_nvdsanalytics.txt``.