How to filter messages before sending to kafka server

I’m building on top of test5 app with Yolo detector and sending messages to kafka. I have areas on the stream that are producing messages that are irrelevant for any further analysis but create significant load on kafka server. Therefore I’m looking for a way to specify a 1, maybe 2 polygons and suppress the message from being sent if it falls within the defined region.

I saw that polygon roi inferencing is not currently supported and that nvinfer can be modified to achieve the same, but since inference is not that much of a problem for me, I thought that filtering just the message would be an easier option.

One way you can try is to modify bbox_generated_probe_after_analytics function, iterate object metadata, if condition not met(need to filter metadata objects which lie outside ROI), set componentId in struct NvDsEventMsgMeta to another value, firstly you need to set “msg-conv-comp-id” and “msg-broker-comp-id” in config to one value, These fields force converter / broker components to process only those messages having same value for componentId field and ignore other messages.

Thanks a lot! I’ll check it out and see if it’s worth sharing