Thank you for that link @kesong!
In the end I have successfully implemented the python bindings, based on the bindings code that I have referenced earlier.
In case someone stumbles onto the same issue, let me share the bindings that work for me, and spare you some time. (I did not start a PR in Github, because it seems like they do not accept contributions.)
bindnvdsmeta.cpp.txt (27.5 KB)
bindtrackermeta.cpp.txt (8.0 KB)
CMakeLists.txt (4.3 KB)
nvdsmetadoc.h.txt (23.7 KB)
setup.py.txt (822 Bytes)
trackermetadoc.h.txt (11.3 KB)
Steps to make it work:
- Download these files, remove .txt ending where logical
- Copy the
.cppfiles to/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/bindings/src/... - Copy the
.hfiles to/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/bindings/docstrings/... - Copy
CMakeLists.txtto/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/bindings/CMakeLists.txt - Copy
setup.pyto/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/bindings/packaging/setup.py - Follow the official bindings guide for compiling them, except for the wheel installation, that should be this:
pip3 install ./pyds-1.1.110-py3-none*.whl
Usage: in a probe use it like this:
batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
l_frame = batch_meta.frame_meta_list
while l_frame is not None:
try:
frame_meta = pyds.glist_get_nvds_frame_meta(l_frame.data)
except StopIteration:
break
l_obj = frame_meta.obj_meta_list
while l_obj is not None:
try:
obj_meta = pyds.glist_get_nvds_object_meta(l_obj.data)
l_user_meta = obj_meta.obj_user_meta_list
while l_user_meta:
try:
user_meta = pyds.NvDsUserMeta.cast(l_user_meta.data)
user_meta_data = None
if user_meta.base_meta.meta_type == pyds.NvDsMetaType.NVDS_TRACKER_OBJ_REID_META:
pReidObj = pyds.NvDsObjReid.cast(user_meta.user_meta_data)
if pReidObj.featureSize > 0:
# logger.info(f"pReidObj.ptr_host: {pReidObj.ptr_host}") # CPU mem pointer
# logger.info(f"pReidObj.ptr_dev: {pReidObj.ptr_dev}") # GPU mem pointer
fingerprint = pReidObj.ptr_host
@kesong, will this feature be a part of the next DeepStream bindings release?