Problem in getting rect_params in deepstream 5 with jetson Xavier NX

Hi there

My problem is that when I want to capture the object bounding-box information, the value of top,left,height, width are not correct. Actually, top and left are half of real values and height and width are zero!
I tested the code in Jetson TX2 and Jetson Nano (with the same JetPack and deepstream version), they works well and I have correct information about bounding-box. But in Jetson Xavier NX the problem is happened.
I used the following code, this is the way that you used in deepstream_imagedata-multistream.py DeepStream-python example.

obj_meta=pyds.NvDsObjectMeta.cast(l_obj.data)
rect_params = obj_meta.rect_params
top = int(rect_params.top)
left = int(rect_params.left)
width = int(rect_params.width)
height = int(rect_params.height)

My platform information:
JetPack: 4.4 dp
DeepStream sdk 5.0
Jetson Xavier NX

I would appreciate it if you help me with this issue.
Thanks in advance

If the code works on the TX2 and Nano, I suspect the the model is having problems on the Xavier. But I can’t tell for sure with the information you provided.

Are you sure that the object meta list is not None? Here is how I’m creating a Python dictionary from a buffer with DeepStream meta:

def nv_ds_label_info_to_dict(label_info):
  meta_dict = {}
  meta_dict['num_classes'] = label_info.num_classes
  meta_dict['result_label'] = label_info.result_label
  meta_dict['result_class_id'] = label_info.result_class_id
  meta_dict['label_id'] = label_info.label_id
  meta_dict['result_prob'] = label_info.result_prob
  return meta_dict

def nv_ds_classifier_meta_to_dict(classifier_meta):
  meta_dict = {}
  meta_dict['num_labels'] = classifier_meta.num_label
  meta_dict['unique_component_id'] = classifier_meta.unique_component_id
  meta_dict['label_info'] = []
  label_info_list = classifier_meta.label_info_list
  while label_info_list:
    label_info = pyds.NvDsLabelInfo.cast(label_info_list.data)
    meta_dict['label_info'].append(nv_ds_label_info_to_dict(label_info))
    label_info_list = label_info_list.next;
  return meta_dict

def nv_ds_object_meta_to_dict(object_meta):
  meta_dict = {}
  meta_dict['class_id'] = object_meta.class_id
  meta_dict['object_id'] = object_meta.object_id
  meta_dict['confidence'] = object_meta.confidence
  meta_dict['rect_params'] = {}
  meta_dict['rect_params']['left'] = object_meta.rect_params.left
  meta_dict['rect_params']['top'] = object_meta.rect_params.top
  meta_dict['rect_params']['width'] = object_meta.rect_params.width
  meta_dict['rect_params']['height'] = object_meta.rect_params.height
  meta_dict['text_params'] = {}
  meta_dict['text_params']['display_text'] = object_meta.text_params.display_text
  meta_dict['classifier'] = []
  classifier_meta_list = object_meta.classifier_meta_list
  while classifier_meta_list:
    classifier_meta = pyds.NvDsClassifierMeta.cast(classifier_meta_list.data)
    meta_dict['classifier'].append(nv_ds_classifier_meta_to_dict(classifier_meta))
    classifier_meta_list = classifier_meta_list.next;
  return meta_dict

def nv_ds_frame_meta_to_dict(frame_meta):
  meta_dict = {}
  meta_dict['frame_num'] = frame_meta.frame_num
  meta_dict['buf_pts'] = frame_meta.buf_pts
  meta_dict['ntp_timestamp'] = frame_meta.ntp_timestamp
  meta_dict['object'] = []
  obj_meta_list = frame_meta.obj_meta_list;
  while obj_meta_list:
    object_meta = pyds.NvDsObjectMeta.cast(obj_meta_list.data)
    meta_dict['object'].append(nv_ds_object_meta_to_dict(object_meta))
    obj_meta_list = obj_meta_list.next;
  return meta_dict

def nv_ds_batch_meta_to_dict(batch_meta):
    meta_dict = {'frame':[]}
    frame_meta_list = batch_meta.frame_meta_list
    while frame_meta_list:
      frame_meta = pyds.NvDsFrameMeta.cast(frame_meta_list.data)
      meta_dict['frame'].append(nv_ds_frame_meta_to_dict(frame_meta))
      frame_meta_list=frame_meta_list.next
    return meta_dict

def get_meta_dict_from_buffer(buf):
    batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(buf))
    if not batch_meta:
        return None
    return nv_ds_batch_meta_to_dict(batch_meta)
1 Like