NvDsUserMeta user data access

**• Hardware Platform : Xavier AGX
**• DeepStream Version: 5.0
**• JetPack Version: 4.4
**• TensorRT Version:
**• NVIDIA GPU Driver Version: 10.2

I’ve a plugin that adds meta data that I can see using the following code:

check_metadata (GstBuffer * inbuf)
NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (inbuf);
NvDsMetaList * l_frame = batch_meta->frame_meta_list;
NvDsMetaList * l_user_meta = NULL;
NvDsUserMeta *user_meta = NULL;
int *user_meta_data = NULL;
int i = 0;

NvDsFrameMeta *frame_meta = (NvDsFrameMeta ) (l_frame->data);
Validate user meta */
for (l_user_meta = frame_meta->frame_user_meta_list; l_user_meta != NULL;
l_user_meta = l_user_meta->next)
user_meta = (NvDsUserMeta *) (l_user_meta->data);
user_meta_data = (int *)user_meta->user_meta_data;

if(user_meta->base_meta.meta_type == WATERLINE_GST_META)
  for(i = 0; i < USER_ARRAY_SIZE; i++)
    g_print("user_meta_data [%d] = %d\n", i, user_meta_data[i]);


Now how can I get access to this meta data using python ? I’ve the following code not throwing any error but it returns a NULL capsule object.

    batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(buffer))
    l_frame = batch_meta.frame_meta_list

    while l_frame is not None:
            # l_frame.data needs a cast to pyds.NvDsFrameMeta
            frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
            l_user_meta = frame_meta.frame_user_meta_list
        except StopIteration:

        while l_user_meta is not None:
                user_meta = pyds.NvDsUserMeta.cast(l_user_meta.data)
                user_meta_data = user_meta.user_meta_data

                print('******* USER DATA: ', user_meta_data)

            except StopIteration:

            except StopIteration:

How can I mimic in Python the content of the C++ check_metadata() routine? I need to get a construct that output the ‘user_meta_data[i]’.
I already spent a couple of days reading the doc but so far without any success. Any help will be greatly appreciated. Thanks

Seems you are using your own customized user meta. You need to generate the python bindings for your new user meta by yourself. The user_meta.user_meta_data should be access through cast.

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