NvDsUserMeta

class pyds.NvDsUserMeta

Holds information of user metadata that user can specify.

Variables:
  • base_metaNvDsBaseMeta, base_meta

  • user_meta_data – User data object to be attached. Refer to deepstream-user-metadata-test example for usage.

Example usage, where user metadata is of type NVDS_TRACKER_PAST_FRAME_META:

l_user=batch_meta.batch_user_meta_list #Retrieve glist containing NvDsUserMeta objects from given NvDsBatchMeta object
while l_user is not None:
    try:
        # Note that l_user.data needs a cast to pyds.NvDsUserMeta
        # The casting is done by pyds.NvDsUserMeta.cast()
        # The casting also keeps ownership of the underlying memory
        # in the C code, so the Python garbage collector will leave
        # it alone
        user_meta=pyds.NvDsUserMeta.cast(l_user.data) 
    except StopIteration:
        break
    if(user_meta and user_meta.base_meta.meta_type==pyds.NvDsMetaType.NVDS_TRACKER_PAST_FRAME_META): #Check data type of user_meta
        try:
            # Note that user_meta.user_meta_data needs a cast to pyds.NvDsPastFrameObjBatch
            # The casting is done by pyds.NvDsPastFrameObjBatch.cast()
            # The casting also keeps ownership of the underlying memory
            # in the C code, so the Python garbage collector will leave
            # it alone
            pPastFrameObjBatch = pyds.NvDsPastFrameObjBatch.cast(user_meta.user_meta_data)
        except StopIteration:
            break
        for trackobj in pyds.NvDsPastFrameObjBatch.list(pPastFrameObjBatch):
            ... #Examine past frame information, see NvDsTrackerMeta docs for details.
        try:
            l_user=l_user.next
        except StopIteration:
            break
cast(*args, **kwargs)

Overloaded function.

  1. cast(self: capsule) -> pyds.NvDsUserMeta

cast given object/data to NvDsUserMeta, call pyds.NvDsUserMeta.cast(data)

  1. cast(self: int) -> pyds.NvDsUserMeta

cast given object/data to NvDsUserMeta, call pyds.NvDsUserMeta.cast(data)