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

**URL:** <https://forums.developer.nvidia.com/t/how-to-add-custom-data-to-analytics-or-send-data-via-kafka-inside-deep-stream/247944>\
**Category:** DeepStream SDK\
**Created:** [March 29, 2023, 9:56am UTC](https://forums.developer.nvidia.com/t/how-to-add-custom-data-to-analytics-or-send-data-via-kafka-inside-deep-stream/247944 "2023-03-29T09:56:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![d.sowmiya86](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@d.sowmiya86](https://forums.developer.nvidia.com/u/d.sowmiya86)\
**Post date:** [March 29, 2023, 9:56am UTC](https://forums.developer.nvidia.com/t/how-to-add-custom-data-to-analytics-or-send-data-via-kafka-inside-deep-stream/247944/1 "2023-03-29T09:56:53Z")

</div>

**• Hardware Platform (Jetson / GPU)**

 ![Screenshot from 2023-03-29 15-01-19](https://global.discourse-cdn.com/nvidia/original/3X/a/d/ad2b06206e1b5dcfc0bb0962d918f764e2907ed9.png)

**• DeepStream Version**  
[nvcr.io/nvidia/deepstream:5.1-21.02-devel](http://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.](https://github.com/NVIDIA-AI-IOT/deepstream-occupancy-analytics.git)  
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

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

```

---

<div class="post-metadata">

**Author:** ![fanzh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fanzh/32/115955_2.png) [@fanzh](https://forums.developer.nvidia.com/u/fanzh)\
**Post date:** [March 30, 2023, 6:19am UTC](https://forums.developer.nvidia.com/t/how-to-add-custom-data-to-analytics-or-send-data-via-kafka-inside-deep-stream/247944/3 "2023-03-30T06:19:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![d.sowmiya86](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@d.sowmiya86](https://forums.developer.nvidia.com/u/d.sowmiya86)\
**Post date:** [March 30, 2023, 6:23am UTC](https://forums.developer.nvidia.com/t/how-to-add-custom-data-to-analytics-or-send-data-via-kafka-inside-deep-stream/247944/4 "2023-03-30T06:23:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fanzh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fanzh/32/115955_2.png) [@fanzh](https://forums.developer.nvidia.com/u/fanzh)\
**Post date:** [March 30, 2023, 6:33am UTC](https://forums.developer.nvidia.com/t/how-to-add-custom-data-to-analytics-or-send-data-via-kafka-inside-deep-stream/247944/5 "2023-03-30T06:33:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![d.sowmiya86](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@d.sowmiya86](https://forums.developer.nvidia.com/u/d.sowmiya86)\
**Post date:** [April 16, 2023, 5:43pm UTC](https://forums.developer.nvidia.com/t/how-to-add-custom-data-to-analytics-or-send-data-via-kafka-inside-deep-stream/247944/6 "2023-04-16T17:43:33Z")

</div>

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” : “”  
}

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [April 30, 2023, 5:44pm UTC](https://forums.developer.nvidia.com/t/how-to-add-custom-data-to-analytics-or-send-data-via-kafka-inside-deep-stream/247944/7 "2023-04-30T17:44:32Z")

</div>

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