Accessing tracker ReID tensor of each object

• Hardware Platform (Jetson / GPU) NVIDIA GeForce RTX 3090
• DeepStream Version 6.3
• JetPack Version (valid for Jetson only)
• TensorRT Version 8.4.0
• NVIDIA GPU Driver Version (valid for GPU only) 535.113.01
• Issue Type(questions, new requirements, bugs) questions

Hello,

I am using a deepstream pipeline in Python.

I was trying to access the tracker reid tensor but I knew that I have to do the bindings myself. With the help of someone here in the forums, I could build the bindings to get the reid tensor of the whole batch. But, I need to do it for each object. When I added a class for each object, I get some errors when I build the bindings.

[ 87%] Building CXX object CMakeFiles/pyds.dir/src/custom_binding/bindcustom.cpp.o
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp: In function 'void pydeepstream::bindtrackermeta(pybind11::module&)':
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:132:20: error: 'NvDsReidTensorObject' was not declared in this scope; did you mean 'NvDsReidTensorBatch'?
  132 |         py::class_<NvDsReidTensorObject>(m, "NvDsReidTensorObject", pydsdoc::trackerdoc::NvDsReidTensorObjectDoc::descr)
      |                    ^~~~~~~~~~~~~~~~~~~~
      |                    NvDsReidTensorBatch
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:132:40: error: template argument 1 is invalid
  132 |         py::class_<NvDsReidTensorObject>(m, "NvDsReidTensorObject", pydsdoc::trackerdoc::NvDsReidTensorObjectDoc::descr)
      |                                        ^
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:134:48: error: 'NvDsReidTensorObject' is not a class, namespace, or enumeration
  134 |                 .def_readwrite("featureSize", &NvDsReidTensorObject::featureSize, pydsdoc::trackerdoc::NvDsReidTensorObjectDoc::featureSize)
      |                                                ^~~~~~~~~~~~~~~~~~~~
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:135:45: error: 'NvDsReidTensorObject' is not a class, namespace, or enumeration
  135 |                 .def_readwrite("ptr_host", &NvDsReidTensorObject::ptr_host, pydsdoc::trackerdoc::NvDsReidTensorObjectDoc::ptr_host)
      |                                             ^~~~~~~~~~~~~~~~~~~~
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:136:44: error: 'NvDsReidTensorObject' is not a class, namespace, or enumeration
  136 |                 .def_readwrite("ptr_dev", &NvDsReidTensorObject::ptr_dev, pydsdoc::trackerdoc::NvDsReidTensorObjectDoc::ptr_dev)
      |                                            ^~~~~~~~~~~~~~~~~~~~
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:137:46: error: 'NvDsReidTensorObject' is not a class, namespace, or enumeration
  137 |                 .def_readwrite("priv_data", &NvDsReidTensorObject::priv_data, pydsdoc::trackerdoc::NvDsReidTensorObjectDoc::priv_data)
      |                                              ^~~~~~~~~~~~~~~~~~~~
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp: In lambda function:
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:140:34: error: 'NvDsReidTensorObject' is not captured
  140 |                          return (NvDsReidTensorObject *) data;
      |                                  ^~~~~~~~~~~~~~~~~~~~
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:139:23: note: the lambda has no capture-default
  139 |                      [](void *data) {
      |                       ^
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:132:20: note: '<typeprefixerror>NvDsReidTensorObject' declared here
  132 |         py::class_<NvDsReidTensorObject>(m, "NvDsReidTensorObject", pydsdoc::trackerdoc::NvDsReidTensorObjectDoc::descr)
      |                    ^~~~~~~~~~~~~~~~~~~~
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:140:56: error: expected primary-expression before ')' token
  140 |                          return (NvDsReidTensorObject *) data;
      |                                                        ^
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:140:57: error: expected ';' before 'data'
  140 |                          return (NvDsReidTensorObject *) data;
      |                                                         ^~~~~
      |                                                         ;
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/bindtrackermeta.cpp:140:58: warning: statement has no effect [-Wunused-value]
  140 |                          return (NvDsReidTensorObject *) data;
      |                                                          ^~~~
In file included from /opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/include/pyds.hpp:34,
                 from /opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/custom_binding/include/bindcustom.hpp:20,
                 from /opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/custom_binding/bindcustom.cpp:21:
/opt/nvidia/deepstream/deepstream/sources/includes/nvdsinfer.h:290:28: warning: missing initializer for member 'NvDsInferDims::d' [-Wmissing-field-initializers]
  290 |     NvDsInferDims dims = {0};
      |                            ^
/opt/nvidia/deepstream/deepstream/sources/includes/nvdsinfer.h:290:28: warning: missing initializer for member 'NvDsInferDims::numElements' [-Wmissing-field-initializers]
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/custom_binding/bindcustom.cpp: In function 'void* pydeepstream::copy_custom_struct(void*, void*)':
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/custom_binding/bindcustom.cpp:27:49: warning: unused parameter 'user_data' [-Wunused-parameter]
   27 |     void * copy_custom_struct(void* data, void* user_data) {
      |                                           ~~~~~~^~~~~~~~~
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/custom_binding/bindcustom.cpp: In function 'void pydeepstream::release_custom_struct(void*, void*)':
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/custom_binding/bindcustom.cpp:48:24: warning: unused variable 'message' [-Wunused-variable]
   48 |                 auto * message = srcData->message;
      |                        ^~~~~~~
/opt/nvidia/deepstream/deepstream-6.3/sources/deepstream_python_apps/bindings/src/custom_binding/bindcustom.cpp:43:52: warning: unused parameter 'user_data' [-Wunused-parameter]
   43 |     void release_custom_struct(void * data, void * user_data) {
      |                                             ~~~~~~~^~~~~~~~~
make[2]: *** [CMakeFiles/pyds.dir/build.make:219: CMakeFiles/pyds.dir/src/bindtrackermeta.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/pyds.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

You will find the binding files attached here.

bindnvdsmeta.cpp.txt (28.0 KB)
bindtrackermeta.cpp.txt (7.4 KB)
nvdsmetadoc.h.txt (24.0 KB)
trackermetadoc.h.txt (9.0 KB)

Thanks.

It is the same topic in: How to access Re-ID tensor for cross camera re-id - Intelligent Video Analytics / DeepStream SDK - NVIDIA Developer Forums

Let track the topic there.