Yes, I added the code below to the " bindtrackermeta.cpp
py::class_<NvDsReidTensorBatch>(m, "NvDsReidTensorBatch",
pydsdoc::trackerdoc::NvDsReidTensorBatchDoc::descr)
.def(py::init<>())
.def_readwrite("featureSize",
&NvDsReidTensorBatch::featureSize)
.def_readwrite("numFilled", &NvDsReidTensorBatch::numFilled)
.def_readonly("ptr_host", &NvDsReidTensorBatch::ptr_host)
.def_readonly("ptr_dev", &NvDsReidTensorBatch::ptr_dev)
.def_readonly("priv_data", &NvDsReidTensorBatch::priv_data)
.def("get_features", [](NvDsReidTensorBatch &self) -> py::array {
auto dtype = py::dtype(py::format_descriptor<float>::format());
return py::array(dtype,
{self.numFilled, self.featureSize},
{sizeof(float) * self.featureSize, sizeof(float)},
self.ptr_host);
},
py::return_value_policy::reference,
pydsdoc::trackerdoc::NvDsReidTensorBatchDoc::get_features)
.def("cast",
[](void *data) {
return (NvDsReidTensorBatch *) data;
},
py::return_value_policy::reference,
pydsdoc::trackerdoc::NvDsReidTensorBatchDoc::cast);
I think ReID tensor is fine, but the problem is reid index.
In “deepstream_app.c”, reidInd
can be obtained by dereferencing user_meta_data as follows.
gint reidInd = *((int32_t *) (user_meta->user_meta_data));
In python, I got reidInd like
reidInd = ctypes.cast(pyds.get_ptr(user_meta.user_meta_data), ctypes.POINTER(ctypes.c_int32).contents.value
When I set USE_NEW_NVSTREAMMUX=yes
, the ReID index is not unique in the batchmeta.
# [(Object ID, ReID index), ...] NvDsReidTensorBatch.numFilled
[(13, 7), (12, 6), (9, 4), (11, 5), (5, 2), (7, 3), (2, 1), (0, 0), (23, 7), (22, 6), (20, 4), (19, 3), (21, 5), (18, 2), (17, 1), (16, 0)] 8
[(24, 0)] 1
[(28, 3), (27, 2), (26, 1), (25, 0)] 4
[(30, 0)] 1
[(31, 0), (32, 0)] 1
[(24, 0), (30, 0)] 1
[(33, 0)] 1
[(34, 0)] 1
[(24, 0), (0, 0)] 1
[(30, 0), (28, 1), (27, 0)] 3
[(29, 0)] 1
[(35, 0)] 1
[(15, 9), (14, 8), (13, 7), (9, 4), (5, 2), (11, 5), (12, 6), (7, 3), (2, 1), (0, 0), (8, 14), (10, 15), (6, 13), (4, 12), (1, 10), (3, 11)] 16
[(33, 0), (36, 0), (16, 1), (24, 1)] 2
[(35, 0), (36, 0), (37, 1)] 2
[(8, 4), (10, 5), (6, 3), (4, 2), (1, 0), (3, 1), (23, 7), (22, 6), (17, 1), (19, 3), (20, 4), (18, 2), (16, 0), (21, 5)] 8
[(27, 0), (28, 1), (39, 2), (5, 2), (2, 1), (0, 0)] 3
[(30, 0), (29, 0)] 1
[(37, 0)] 1
[(35, 0)] 1
[(32, 0), (39, 0)] 1
[(19, 3), (23, 7), (22, 6), (17, 1), (20, 4), (21, 5), (18, 2), (16, 0), (15, 9), (14, 8), (13, 7), (9, 4), (12, 6), (11, 5), (5, 2), (7, 3), (2, 1), (0, 0)] 10
[(1, 0), (33, 0)] 1
[(25, 0), (30, 0)] 1
[(8, 4), (10, 5), (6, 3), (4, 2), (3, 1), (1, 0)] 6
[(0, 0), (24, 0)] 1
[(37, 1), (29, 0)] 2
[(36, 0), (39, 0)] 1
[(8, 4), (10, 5), (6, 3), (4, 2), (1, 0), (3, 1), (22, 6), (23, 7), (17, 1), (19, 3), (20, 4), (21, 5), (18, 2), (16, 0)] 8
[(35, 0), (36, 0)] 1
[(1, 0), (33, 0)] 1
[(5, 2), (0, 0), (2, 1), (28, 2), (27, 1), (25, 0)] 3
[(37, 0)] 1
[(35, 0)] 1
[(36, 0), (39, 6), (19, 10), (22, 13), (23, 14), (20, 11), (17, 8), (21, 12), (18, 9), (16, 7), (8, 4), (10, 5), (6, 3), (4, 2), (3, 1), (1, 0)] 15
[(15, 8), (14, 7), (12, 6), (9, 4), (11, 5), (7, 3), (5, 2), (0, 0), (2, 1)] 9
[(43, 0), (44, 0)] 1
[(47, 0)] 1
[(35, 0)] 1
[(36, 0)] 1
[(10, 4), (6, 2), (8, 3), (4, 1), (3, 0), (22, 5), (19, 2), (23, 6), (21, 4), (20, 3), (18, 1), (17, 0)] 7
[(15, 9), (12, 6), (14, 8), (9, 4), (13, 7), (11, 5), (5, 2), (7, 3), (0, 0), (2, 1), (48, 0)] 10
[(29, 0), (45, 1)] 2
[(37, 0)] 1
[(35, 0)] 1
[(36, 0), (19, 2), (23, 6), (22, 5), (20, 3), (18, 1), (21, 4), (17, 0)] 7
[(8, 3), (10, 4), (6, 2), (4, 1), (3, 0)] 5
[(15, 9), (14, 8), (12, 6), (7, 3), (9, 4), (11, 5), (5, 2), (2, 1), (13, 7), (0, 0), (33, 0)] 10
[(30, 0), (48, 0)] 1
[(29, 0), (45, 1)] 2
[(0, 0), (2, 1), (24, 1), (48, 0)] 2
[(50, 2), (37, 3), (41, 4), (29, 0), (45, 1)] 5
[(36, 0)] 1
[(8, 4), (10, 5), (6, 3), (4, 2), (3, 1), (1, 0)] 6
[(17, 0), (24, 0)] 1
[(23, 6), (19, 2), (18, 1), (22, 5), (20, 3), (21, 4), (17, 0)] 7
[(15, 9), (14, 8), (12, 6), (0, 0), (7, 3), (5, 2), (2, 1), (11, 5), (9, 4), (13, 7), (10, 4), (8, 3), (6, 2), (4, 1), (3, 0), (51, 5), (52, 10), (33, 11)] 12