Copy NvDsBatchMeta from input buffer to output buffer while using TEE with tiler and appsink

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) dGPU
• DeepStream Version 6.1
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only) 525
• Issue Type( questions, new requirements, bugs) Question
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

I have a pipeline with 4 cameras. I want to send the nvdsbatchmeta as a json message to a kafka server as well as visualize with NvDsOSD and display sink. I used a simple Tee element to divide the branch between appsink and displaysink. What I found was that the NvTiler plugin which tiles the streams for parallel visualization of all streams, modifies the NvDsBatchMeta in place. This causes, my appsink to parse and send faulty detection data (it is offset based on source id!).

To counter this, I created a custom plugin called KdsBatchMetaCopy that is derived from GstBaseTransorm class and implements prepare_buf method like so

/* prepare buffer */
static GstFlowReturn kdsbatchmetacopy_prepare_buf(
          GstBaseTransform *trans,
          GstBuffer *input, 
          GstBuffer **outbuf  )
{
  *outbuf = gst_buffer_copy(input); //should only copy buffer meta but not rgb frame data
  return GST_FLOW_OK;
}

This worked for me and I was able to successfully decouple both branches.

tee → q → metacopy → tiler → displaysink
`----> q → appsink

Unfortunately, there is a massive performance and fps drop. I measured about 3fps/stream drop due to this copy. From ~7fps/stream it came down to 4 fps when display branch is ON. The effect is more pronounced when I increase the number of streams. In 2 streams, this diff is ~1 which is negligible. In 8 streams, this becomes almost ~6.5.

I tested and confirmed that the batchmetacopy plugin is the source of this fps drop. I want to know if there is a way for me to speed up the buffer copy by only copying the metadata nvdsbatchmeta and not touch the image data in prepare_buf method.

@Morganh - would really appreciate your quick thoughts on this.

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

We haven’t provide a shallow copy API at present. Maybe you can try to create a new nvdsbatchmeta and just copy the paras you wanted to it.

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