# How do I tell Kafka about SGIE results in deepstream-test5?

**URL:** <https://forums.developer.nvidia.com/t/how-do-i-tell-kafka-about-sgie-results-in-deepstream-test5/298656>\
**Category:** DeepStream SDK\
**Created:** [July 4, 2024, 12:04pm UTC](https://forums.developer.nvidia.com/t/how-do-i-tell-kafka-about-sgie-results-in-deepstream-test5/298656 "2024-07-04T12:04:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluerayi](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bluerayi](https://forums.developer.nvidia.com/u/bluerayi)\
**Post date:** [July 4, 2024, 12:04pm UTC](https://forums.developer.nvidia.com/t/how-do-i-tell-kafka-about-sgie-results-in-deepstream-test5/298656/1 "2024-07-04T12:04:40Z")

</div>

I am trying to send a message to Kafka using deepstream-test5.

In the configuration file that comes with deepstream-test5, I can set `[sink1]` to `enable` and edit the server information to see the messages immediately.

BTW, the screen output that starts in this state and is connected to xhost shows information about the type and make of the car. I am aware that these information are inferred by Secondary GIE.  
On the other hand, the message sent to Kafka only shows the class name of the object detection, which seems to be inferred by Primary GIE, and I cannot confirm detailed information about these cars.

I recognize that I can customize the messages by compiling `libnvds_msgconv.so` by myself. In my environment, customization was possible by editing `eventmsg_payload.cpp`.  
However, I checked some values of the `NvDsEventMsgMeta` structure handled by `eventmsg_payload.cpp`, but I can’t find the Secondary GIE inference result in any way.  
Is there any way to retrieve this?

Or is it possible with the code in `dsmeta_payload.cpp`? However, I tried setting `msg-conv-msg2p-newapi` in `[sink1]` to `1`, but there is no change in the message.

Any help would be appreciated.  
Thanks.

**• Hardware Platform (Jetson / GPU)**: GPU  
**• DeepStream Version** : 7.0  
**• TensorRT Version** : 8.6.1.6-1+cuda12.0  
**• NVIDIA GPU Driver Version (valid for GPU only)**: NVIDIA UNIX x86\_64 Kernel Module 550.90.07 Fri May 31 09:35:42 UTC 2024  
**• Issue Type( questions, new requirements, bugs)**: questions

---

<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:** [July 5, 2024, 8:55am UTC](https://forums.developer.nvidia.com/t/how-do-i-tell-kafka-about-sgie-results-in-deepstream-test5/298656/3 "2024-07-05T08:55:06Z")

</div>

if msg-conv-msg2p-newapi is 1, you need to modify dsmeta\_payload.cpp. please refer to the [doc](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvmsgconv.html#gst-nvmsgconv) for the difference. you can add log to check.

---

<div class="post-metadata">

**Author:** ![bluerayi](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bluerayi](https://forums.developer.nvidia.com/u/bluerayi)\
**Post date:** [July 8, 2024, 8:28am UTC](https://forums.developer.nvidia.com/t/how-do-i-tell-kafka-about-sgie-results-in-deepstream-test5/298656/4 "2024-07-08T08:28:23Z")

</div>

Thanks for the reply.

Yes, I too thought that changing `msg-conv-msg2p-newapi` should change the referenced source code. However, as I mentioned in the text, changing this setting does not work as I expected.

Specifically, I did the following as a simple test. Note that the container used is `nvcr.io/nvidia/deepstream:7.0-gc-triton-devel`.

1. in `/opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvmsgconv/deepstream_schema/dsmeta_payload.cpp`, insert the following code at line 282:

```cpp
json_object_set_string_member(objectObj, "source", "dsmeta");

```

1. in `/opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvmsgconv/deepstream_schema/eventmsg_payload.cpp`, insert the following code at line 727:

```cpp
json_object_set_string_member(objectObj, "source", "eventmsg");

```

1. run `make` in `/opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvmsgconv/` to compile `libnvds_msgconv.so`
2. edit `/opt/nvidia/deepstream/deepstream-7.0/sources/apps/sample_apps/deepstream-test5/config/test5_config_file_nvmultiurisrcbin_src_list_attr_all.txt` and replace lines 99 and after with the following:

```auto
[sink1]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=UDPSink 5=nvdrmvideosink 6=MsgConvBroker
type=6
msg-conv-config=dstest5_msgconv_sample_config.txt
#(0): PAYLOAD_DEEPSTREAM - Deepstream schema payload
#(1): PAYLOAD_DEEPSTREAM_MINIMAL - Deepstream schema payload minimal
#(256): PAYLOAD_RESERVED - Reserved type
#(257): PAYLOAD_CUSTOM - Custom schema payload
msg-conv-payload-type=0
msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream/lib/libnvds_kafka_proto.so
#Provide your msg-broker-conn-str here
msg-broker-conn-str=localhost;9092;ds
topic=ds
#Optional:
#msg-broker-config=../../deepstream-test4/cfg_kafka.txt
#new-api=0
#(0) Use message adapter library api's
#(1) Use new msgbroker library api's
msg-conv-msg2p-lib=/opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvmsgconv/libnvds_msgconv.so
msg-conv-msg2p-newapi=1 #!!

```

1. Start Kafka on localhost:9092 and subscribe to the `ds` topic.
2. run `. /deepstream-test5 -c configs/test5_config_file_nvmultiurisrcbin_src_list_attr_all.txt`.

As a result, the `object.source` of the received message will be `"eventmsg"` regardless of whether `msg-conv-msg2p-newapi` is set to `0` or `1`.

Anyway, the main question is: Is there any way to put the SGIE classification results in the deepstream-test5 application, i.e. car type, car make, etc. in the Kafka message?

Thank you in advance.

---

<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:** [July 8, 2024, 8:36am UTC](https://forums.developer.nvidia.com/t/how-do-i-tell-kafka-about-sgie-results-in-deepstream-test5/298656/5 "2024-07-08T08:36:00Z")

</div>

> [@bluerayi](#):
>
> ```auto
> msg-conv-msg2p-newapi=1 #!!
> 
> ```

please use msg-conv-msg2p-new-api=1. please refer to opt\nvidia\deepstream\deepstream-7.0\sources\apps\sample\_apps\deepstream-test5\configs\test5\_dec\_infer-resnet\_tracker\_sgie\_tiled\_display\_int8.txt

---

<div class="post-metadata">

**Author:** ![bluerayi](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bluerayi](https://forums.developer.nvidia.com/u/bluerayi)\
**Post date:** [July 10, 2024, 8:11am UTC](https://forums.developer.nvidia.com/t/how-do-i-tell-kafka-about-sgie-results-in-deepstream-test5/298656/6 "2024-07-10T08:11:48Z")

</div>

Thank you for your answer.

I was able to switch the metadata used for message construction from event messages to frames and objects by using `msg-conv-msg2p-new-api` instead of `msg-conv-msg2p-newapi`. I had mistakenly set it up because [the documentation for the configuration item](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_ref_app_deepstream.html#sink-group) linked from [the deepstream-test5 documentation](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_ref_app_test5.html) said `msg-conv-msg2p-newapi`.

And now that we have switched the metadata, the SGIE results are sent as messages without having to change the nvmsgconv code. Therefore, this question has been resolved.

Thank you all for your help.

---

<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:** [July 24, 2024, 8:12am UTC](https://forums.developer.nvidia.com/t/how-do-i-tell-kafka-about-sgie-results-in-deepstream-test5/298656/7 "2024-07-24T08:12:03Z")

</div>

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