About customizing the center point in NvDsAnalytics plugin

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
NVIDIA RTX 2060
• DeepStream Version
6.2 (from the Docker Deepstream 6.2 Image)
• JetPack Version (valid for Jetson only)
• TensorRT Version
8.5.2.2
• NVIDIA GPU Driver Version (valid for GPU only)
525.105.17
• Issue Type( questions, new requirements, bugs)
We are currently using the NvDsAnalytics plugin for our pipeline to detect Line Crossing events. Based on the documentation, the Line Crossing event is triggered based on when the bottom center point of the bounding box passes the line:

"For all the analytics calculations bottom center coordinate of bounding box of an object is being used. If bounding box is defined as (x_left, y_top, width, height) then the bottom center coordinate would be (x_left + width/2, y_top + height)"

We would like to know whether it would be possible to add in additional configurations to specify the center point instead. To be specific, it would be great if we can add in some offset for the calculation like so:

(x_left + width*x_offset, y_top + height*y_offset)

By default x_offset = 0.5, y_offset = 1 would retain the original behaviour of the plugin.

Custom offsets would help with our cases as we’re aiming to detect line crossing of vehicles by moving the center point closer to the part of the vehicle (with x_offset = 0.5, y_offset = 0.8) to improve event accuracy, like in the image where if we detect the red dot the result would be incorrect, while the green dot would be correct.
image

In our pipeline, we did some workaround by modifying the metadata before and after passing through the plugin with the code below. It works as a temporary fix but it would be more convenient if this was done inside the plugin.

// Before passing through the plugin
GstPadProbeReturn IntelligentTransportationSystem::bboxmul_sink_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info, gpointer u_data) {
  GstBuffer *buf = (GstBuffer *) info->data;
  NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);
  NvDsMetaList * l_frame = NULL;
  NvDsMetaList * l_obj = NULL;
  NvDsMetaList * l_class = NULL;

  for (l_frame = batch_meta->frame_meta_list; l_frame != NULL; l_frame = l_frame->next) {
    NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
    for (l_obj = frame_meta->obj_meta_list; l_obj != NULL; l_obj = l_obj->next) {
      NvDsObjectMeta *obj_meta = (NvDsObjectMeta *) (l_obj->data);
      
      NvOSD_RectParams *rectParams = &obj_meta->rect_params;
      rectParams->height = rectParams->height *0.8;
      
    }
  }
  return GST_PAD_PROBE_OK;
}

// After passing through the plugin. Restore the bbox height to normal
GstPadProbeReturn IntelligentTransportationSystem::bboxdiv_sink_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info, gpointer u_data) {
  GstBuffer *buf = (GstBuffer *) info->data;
  NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);
  NvDsMetaList * l_frame = NULL;
  NvDsMetaList * l_obj = NULL;
  NvDsMetaList * l_class = NULL;

  for (l_frame = batch_meta->frame_meta_list; l_frame != NULL; l_frame = l_frame->next) {
    NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
    for (l_obj = frame_meta->obj_meta_list; l_obj != NULL; l_obj = l_obj->next) {
      NvDsObjectMeta *obj_meta = (NvDsObjectMeta *) (l_obj->data);
      
      NvOSD_RectParams *rectParams = &obj_meta->rect_params;
      rectParams->height = rectParams->height /0.8;
      
    }
  }
  return GST_PAD_PROBE_OK;
}

Will this be possible as a new update or a new .so file? Or will the source code for the plugin be released in the near future?
• 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)

1 Like

Thanks for your suggestion, we will consider it.

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