NvDsInferTensorMeta equal to None

Hi everyone,

I am facing a problem with empty Tensor meta data. Based on

I built a small pipeline with two models (first one is a detector and second one is a classifier). My source is a video file (.h264 format). At the end of my pipeline I used

osdsinkpad.add_probe(Gst.PadProbeType.BUFFER, osd_sink_pad_buffer_probe, 0)

to print the user meta data list via


where user_meta is of the form obj_meta.obj_user_meta_list.

However, for some frames the TensorMeta object is None although the detector found an object in the frame (there are some frames for which I actually get an array with the corresponding probabilities of the classifier). Moreover, there are also frames which contain no objects but anyway they contain TensorMeta data.

For a better understanding I post the osd_sink_pad_buffer_probe function:


def gst_meta_list_loop(func):
def wrapper(meta_list):
listiter = meta_list
while listiter:
yield func(listiter.data)
listiter = listiter.next
except StopIteration:
return wrapper

def frame_meta_list(batch_meta_data):
“”" Used to obtain a generator object to loop over a batch_meta_data_list. “”"
return pyds.NvDsFrameMeta.cast(batch_meta_data)

def object_meta_list(object_meta_data):
“”" Used to obtain a generator object to loop over a object_meta_data_list. “”"
return pyds.NvDsObjectMeta.cast(object_meta_data)

def user_meta_list(object_meta_data):
“”" Used to obtain a generator object to loop over a object_meta_data_list. “”"
return pyds.NvDsUserMeta.cast(object_meta_data)

def osd_sink_pad_buffer_probe(pad, info, u_data):
frame_number = 0
# Intiallizing object counter with 0.
obj_counter = {
num_rects = 0

gst_buffer = info.get_buffer()
if not gst_buffer:
    print("Unable to get GstBuffer ")

# Retrieve batch metadata from the gst_buffer
# Note that pyds.gst_buffer_get_nvds_batch_meta() expects the
# C address of gst_buffer as input, which is obtained with hash(gst_buffer)
batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
for frame_meta in frame_meta_list(batch_meta.frame_meta_list):
    frame_number = frame_meta.frame_num
    num_rects = frame_meta.num_obj_meta
    for obj_meta in object_meta_list(frame_meta.obj_meta_list):
        for user_meta in user_meta_list(obj_meta.obj_user_meta_list):
            tensor_data = pyds.NvDsInferTensorMeta.cast(user_meta.user_meta_data)
            tensor_meta = pyds.NvDsInferTensorMeta.cast(user_meta.user_meta_data)
            layer = pyds.get_nvds_LayerInfo(tensor_meta, 0)
            # Convert the tensor output meta to a numpy array containing the fingerprint
            ptr = ctypes.cast(pyds.get_ptr(layer.buffer), ctypes.POINTER(ctypes.c_float))
            probs = np.array(np.ctypeslib.as_array(ptr, shape=(layer.dims.numElements,)), copy=True)
        obj_counter[obj_meta.class_id] += 1
return Gst.PadProbeReturn.OK

Thanks in advance for your help.

**• Hardware Platform Jetson TX2 *
• DeepStream Version 5.0
• JetPack Version 4.4

Have you removed nvtracker when you try to print TensroMeta for every object in every frame? Nvtracker will skip some objects which are judged as the same object in previous frames.


thank you very much. That already solved the problem.