Accessing past frame tracking results from python

I am trying to access the object tracking results of the pasts frames. I would like to achieve the same results from python as in the write_kitti_past_track_output function of the reference app, deepstream_app.c. Unfortunately I could not find the python bindings for the necessary classes, NvDsPastFrameObjBatch, NvDsPastFrameObjStream, NvDsPastFrameObjList and NvDsPastFrameObj. I can read only the user meta data:

# In the probe callback, after obtaining a batch_meta and the user_meta:
    print('user_meta.base_meta.meta_type:', user_meta.base_meta.meta_type)

This prints the following:

user_meta.base_meta.meta_type: NvDsMetaType.???

And of course, in the lack of the corresponding python classes, I can not cast user_meta.user_meta_data in anything useful. Are there any way to read the past frame metadata from python?

• Hardware Platform: Jetson
• DeepStream Version: 5.0 DP

1 Like

For anyone else who would like to access the past frame tracking meta of the DeepStream nvtracker plugin, I created and open sourced the necessary python bindings here: GitHub - mrtj/pyds_tracker_meta: pybind11 wrapper to access Nvidia DeepStream tracker meta info from Python.

Hi @janos.tolgyesi
Cool! Thanks for sharing!

Hello, it seems that for DeepStream 5.0 public release nvidia indeed has included the past frame tracking results meta: Deepstream Python API Reference — Deepstream Deepstream Version: 6.1.1 documentation

@mchi do you have some working example on how to use these classes? Until now I arrived to this:

def buffer_probe_callback(pad, info, u_data):
    gst_buffer = info.get_buffer()
    batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
    user_meta_list = batch_meta.batch_user_meta_list
    while user_meta_list is not None:
        user_meta = pyds.NvDsUserMeta.cast(user_meta_list.data)
        if user_meta.base_meta.meta_type == pyds.NvDsMetaType.NVDS_TRACKER_PAST_FRAME_META:
            print("Found past frame meta")
        try:
            user_meta_list = user_meta_list.next
        except StopIteration:
            break

Indeed this code prints the “Found past frame meta” lines. What I miss is how to extract / cast the pyds.NvDsPastFrameObjBatch instances from the user meta. Maybe some cast method is missing from this class?

I opened a new thread for using the official past frame tracker meta classes in DeepStream 5.0 public release: How to access past frame tracking results from python in DeepStream 5.0