NvDsObjectMeta

class pyds.NvDsObjectMeta

Holds information of object metadata in the frame.

Variables:
  • base_metaNvDsBaseMeta, base_meta

  • parent – the parent NvDsObjectMeta object. Set to None if parent is not present

  • unique_component_idint, unique component id that attaches NvDsObjectMeta metadata

  • class_idint, Index of the object class infered by the primary detector/classifier

  • object_idint, Unique ID for tracking the object. @ref UNTRACKED_OBJECT_ID indicates the object has not been tracked

  • confidencefloat, Holds a confidence value for the object, set by the inference component. Confidence will be set to -0.1, if “Group Rectangles” mode of clustering is chosen since the algorithm does not preserve confidence values. Also, for objects found by tracker and not inference component, confidence will be set to -0.1

  • detector_bbox_infoNvDsComp_BboxInfo, Holds a structure containing bounding box parameters of the object when detected by detector

  • tracker_bbox_infoNvDsComp_BboxInfo, Holds a structure containing bounding box coordinates of the object when processed by tracker

  • tracker_confidencefloat, Holds a confidence value for the object set by nvdcf_tracker. tracker_confidence will be set to -0.1 for KLT and IOU tracker

  • rect_paramsNvOSD_RectParams, Structure containing the positional parameters of the object in the frame. e.g. If the tracker component is after the detector component in the pipeline, then positional parameters are from tracker component. Can also be used to overlay borders / semi-transparent boxes on top of objects. See NvOSD_RectParams

  • mask_paramsNvOSD_MaskParams, Holds mask parameters for the object. This mask is overlaid on object See NvOSD_MaskParams

  • text_paramsNvOSD_TextParams, Text describing the object can be overlayed using this structure. See NvOSD_TextParams

  • obj_label – An array to store the string describing the class of the detected object

  • classifier_meta_list – list of objects of type NvDsClassifierMeta

  • obj_user_meta_list – list of objects of type NvDsUserMeta

  • misc_obj_infolist of int, For additional user specific batch info

  • reservedint, Reserved for internal use.

Example usage:

#Initialize dict to keep count of objects of each type
obj_counter = {
        PGIE_CLASS_ID_VEHICLE:0,
        PGIE_CLASS_ID_PERSON:0,
        PGIE_CLASS_ID_BICYCLE:0,
        PGIE_CLASS_ID_ROADSIGN:0
    }

l_obj=frame_meta.obj_meta_list #Retrieve list of NvDsObjectMeta objects in frame from an NvDsFrameMeta object. See NvDsFrameMeta documentation for more details.
while l_obj is not None:
    try:
        # Casting l_obj.data to pyds.NvDsObjectMeta
        obj_meta=pyds.NvDsObjectMeta.cast(l_obj.data)
        except StopIteration:
            break
        obj_counter[obj_meta.class_id] += 1 #Retrieve class_id from NvDsObjectMeta (i.e. PGIE_CLASS_ID_VEHICLE, PGIE_CLASS_ID_PERSON, etc.) to update count
        obj_meta.rect_params.border_color.set(0.0, 0.0, 1.0, 0.0) #Set border color of NvDsObjectMeta object's rect_params
        try: 
            l_obj=l_obj.next
        except StopIteration:
            break
cast(*args, **kwargs)

Overloaded function.

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

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

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

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