How to add custom data to analytics or send data via kafka inside deep stream

• Hardware Platform (Jetson / GPU)

• DeepStream Version
nvcr.io/nvidia/deepstream:5.1-21.02-devel

We are using the deep stream occupancy analytics application
GitHub - NVIDIA-AI-IOT/deepstream-occupancy-analytics: This is a sample application for counting people entering/leaving in a building using NVIDIA Deepstream SDK, Transfer Learning Toolkit (TLT), and pre-trained models. This application can be used to build real-time occupancy analytics applications for smart buildings, hospitals, retail, etc. The application is based on deepstream-test5 sample application.
This application sends data such as occupancy count/entry & exit count via Kafka. as below

{
“messageid” : “e8c9df88-3a19-411b-8669-c0ee67d3d33a”,
@timestamp” : “2023-03-29T09:04:46.128Z”,
“analyticsModule” : {
“occupancy” : 2.0,
“source_id” : 0.0,
“Entry” : 0.0,
“Exit” : 0.0
},
“videoPath” : “”
}
{
“messageid” : “2699c9a7-cdb5-431d-a98b-6fc637d03d26”,
@timestamp” : “2023-03-29T09:04:46.178Z”,
“analyticsModule” : {
“occupancy” : 2.0,
“source_id” : 0.0,
“Entry” : 0.0,
“Exit” : 0.0
},
. In addition to these above data we need to add object type, ex: person & Tracking ids of each object,bounding box of the object and that need to be consumed via kafka. How to add object type(person) and tracking ids of the object to the Kafka messages and consume at the kafka consumer end.

In the occupancy analytics plugin the below section of code send entry,exit,occupancy counts via kafka
meta->occupancy = obj_params->lccum_cnt;
meta->lccum_cnt_entry = obj_params->lcc_cnt_entry;
meta->lccum_cnt_exit = obj_params->lcc_cnt_exit ;
meta->source_id = obj_params->source_id;
In addition to these meta data , we need the object type (person)and the Track-id of the object, bounding box of the object. Not able to find the suitable plugin or code base.
The sample output we require in addition to entry/exit/occupancy counts

{
  "version" : "Nov 21 2022 06:03:10",
  "timestamp" : 20221121060326389,
  "sensorId" : 0,
  "object" : {
    "id" : 9,
    "type" : "person",
    "bbox" : [
      296,
      441,
      183,
      425
    ],

first you need to add information in generate_event_msg_meta.
second please modify nvmsgconv low level lib, which is opensource, the path is opt\nvidia\deepstream\deepstream\sources\libs\nvmsgconv\nvmsgconv.cpp, you need to modify generate_dsmeta_message or generate_dsmeta_message_minimal.
moreover, you need to replace the old /opt/nvidia/deepstream/deepstream/lib/libnvds_msgconv.so after rebuilding.

Can you provide me the reference code base for this please!

you can add extra information in NvDsEventMsgMeta’s extMsg, then use it in nvmsgconv low level lib, please refer to generate_event_message_minimal, the path isopt\nvidia\deepstream\deepstream\sources\libs\nvmsgconv\deepstream_schema\eventmsg_payload.cpp

1 Like

kindly help me on how to get the bounding box values via kafka using deep stream test 5 application

sensor" : {
“id” : “HWY_20_AND_LOCUST__EBA__4_11_2018_4_59_59_508_AM_UTC-07_00”,
“type” : “Camera”,
“description” : “Aisle Camera”,
“location” : {
“lat” : 45.293701446999997,
“lon” : -75.830391449900006,
“alt” : 48.155747933800001
},
“coordinate” : {
“x” : 5.2000000000000002,
“y” : 10.1,
“z” : 11.199999999999999
}
},
“analyticsModule” : {
“id” : “XYZ”,
“description” : “”,
“source” : “OpenALR”,
“version” : “1.0”
},
“object” : {
“id” : “388”,
“speed” : 0.0,
“direction” : 0.0,
“orientation” : 0.0,
“person” : {
“age” : 0,
“gender” : “”,
“hair” : “”,
“cap” : “”,
“apparel” : “”,
“confidence” : 1.0
},
“bbox” : {
“topleftx” : 0,
“toplefty” : 0,
“bottomrightx” : 0,
“bottomrighty” : 0
},
“location” : {
“lat” : 0.0,
“lon” : 0.0,
“alt” : 0.0
},
“coordinate” : {
“x” : 0.0,
“y” : 0.0,
“z” : 0.0
}
},
“event” : {
“id” : “493fb880-afbe-4624-a737-4d21a46da1c6”,
“type” : “entry”
},
“videoPath” : “”
}

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.