• Hardware Platform: Jetson AGX Orin Developer Kit 64 GB • DeepStream Version: : 7.1 • JetPack Version: 6.2 • TensorRT Version: Not sure • NVIDIA GPU Driver Version (valid for GPU only): Not sure
Hello,
As a heads up, I am pretty new to DeepStream, and I am using the DeepStream Python bindings to generate the NVIDIA DeepStream pipeline.
I have created a pipeline that runs on the GPU and takes pictures from my camera to infer them using a YOLOv7 model. What I want to do now is use nvmsgconv and nvmsgbroker to publish messages to Redis using the Redis DeepStream plugin. Specifically, I would like to publish a custom payload, such as a JSON object that contains some information from the inference, as well as the image that was sent to the inference server.
This plugin can be used to implement a custom schema:
By implementing the nvds_msg2p interface: If a library that implements the custom schema needs to be integrated with the DeepStream SDK, wrap the library in the nvds_msg2p interface and set the plugin’s msg2p-libproperty to the library’s name. Set the payload-type property to PAYLOAD_CUSTOM.
I am not sure how to proceed, but I believe I need to implement nvds_msg2p in C++. My question is: once I have implemented that interface, how can I call the implementation from the Python code? I have checked the documentation, but I haven’t found an example of this.
To use a custom payload with nvmsgconv and nvmsgbroker from Python, implement your custom nvds_msg2p interface in C++ as a shared library, then set it via:
From Python, attach data to each frame using nvds_add_user_meta_to_frame() with a NvDsEventMsgMeta object. This metadata will be passed to your C++ payload.
Yes, I have already implemented my custom nvds_msg2p interface. The thing is that NvDsEventMsgMeta already has its structure defined. If I want to add a new type of object to NvDsEventMsgMeta, I would need to define it and compile it with the rest of the DeepStream code, correct?
I would need to create a type in C++ called CustomPayload and add it as a new attribute to NvDsEventMsgMeta, then compile everything again, right?
Moreover, I would have to allocate memory for this new object. This means I would also need to modify the Python bindings to create a function like pyds.alloc_nvds_person_object() and recompile the bindings. Is this the process you would recommend, or is there an easier way?
I’ve checked also your replies in other threads such as this one and I wonder if the information there could be applicable in this case. What do you think?
Thank you!
if you want to send image, please find “3.Send the image by the broker based on Kafka” in the readme of /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-test4/.
Thanks for your message, I checked the file that you mentioned. It says I have to set payload-type and msg2p-newapi to 1. But then I wouldnt be able to send a custom json, or am I missing something?
If I want to send a JSON such as
Also, I thought it would be easier to send custom data through the otherAtts property from the NvDsEventMsgMeta. If I would use the newapi I wouldn’t be able to use this property and would have to create a custom object?
deepstream-test4 is a ready-made sample to send jpg. How to write it in Python is mentioned in the readme.. Yes, If you want to send images, please set the “payload-type: 1” and “msg2p-newapi: 1”.
if you want to use otherAtts, please refer to this topic.
There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks