Thanks for the refrence. As i went through the code:
write_reid_track_output (AppCtx * appCtx, NvDsBatchMeta * batch_meta)
{
if (!appCtx->config.reid_track_dir_path)
return;
gchar reid_file[1024] = { 0 };
FILE *reid_params_dump_file = NULL;
/** Find batch reid tensor in batch user meta. */
NvDsReidTensorBatch *pReidTensor = NULL;
for (NvDsUserMetaList *l_batch_user = batch_meta->batch_user_meta_list; l_batch_user != NULL;
l_batch_user = l_batch_user->next) {
NvDsUserMeta *user_meta = (NvDsUserMeta *) l_batch_user->data;
if (user_meta && user_meta->base_meta.meta_type == NVDS_TRACKER_BATCH_REID_META) {
pReidTensor = (NvDsReidTensorBatch *) (user_meta->user_meta_data);
}
}
/** Save the reid embedding for each frame. */
for (NvDsMetaList * l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) l_frame->data;
/** Create dump file name. */
guint stream_id = frame_meta->pad_index;
g_snprintf (reid_file, sizeof (reid_file) - 1,
"%s/%02u_%03u_%06lu.txt", appCtx->config.reid_track_dir_path,
appCtx->index, stream_id, (gulong) frame_meta->frame_num);
reid_params_dump_file = fopen (reid_file, "w");
if (!reid_params_dump_file)
continue;
if (!pReidTensor)
continue;
/** Save the reid embedding for each object. */
for (NvDsMetaList * l_obj = frame_meta->obj_meta_list; l_obj != NULL;
l_obj = l_obj->next) {
NvDsObjectMeta *obj = (NvDsObjectMeta *) l_obj->data;
guint64 id = obj->object_id;
for (NvDsUserMetaList * l_obj_user = obj->obj_user_meta_list; l_obj_user != NULL;
l_obj_user = l_obj_user->next) {
/** Find the object's reid embedding index in user meta. */
NvDsUserMeta *user_meta = (NvDsUserMeta *) l_obj_user->data;
if (user_meta && user_meta->base_meta.meta_type == NVDS_TRACKER_OBJ_REID_META
&& user_meta->user_meta_data) {
gint reidInd = *((int32_t *) (user_meta->user_meta_data));
if (reidInd >= 0 && reidInd < (gint)pReidTensor->numFilled) {
fprintf (reid_params_dump_file, "%lu", id);
for (guint ele_i = 0; ele_i < pReidTensor->featureSize; ele_i++) {
fprintf (reid_params_dump_file, " %f",
pReidTensor->ptr_host[reidInd * pReidTensor->featureSize + ele_i]);
}
fprintf (reid_params_dump_file, "\n");
}
}
}
}
fclose (reid_params_dump_file);
}
}
i could find a meta type called NVDS_TRACKER_BATCH_REID_META in c implementation.
But as i used this in the python version of DS implementation as below, i couldn’t find this meta:
def tiler_src_pad_buffer_probe_tracker_test(pad,info, u_data):
gst_buffer = info.get_buffer()
if not gst_buffer:
print("Unable to get GstBuffer ")
return
batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
l_user=batch_meta.batch_user_meta_list #
while l_user is not None:
try:
user_meta= pyds.NvDsUserMeta.cast(l_user.data)
except StopIteration:
break
print(user_meta.base_meta.meta_type)
if user_meta and user_meta.base_meta.meta_type == pyds.NVDS_TRACKER_BATCH_REID_META:
pReidTensor = user_meta.user_meta_data
try:
l_user=l_user.next
except StopIteration:
break
# if user_meta and user_meta.base_meta.meta_type == NVDS_TRACKER_BATCH_REID_META:
# pReidTensor = user_meta.user_meta_data
return Gst.PadProbeReturn.OK
i could get the following type of basemeta as i print the base_meta.meta_type:
NvDsMetaType.NVDSINFER_TENSOR_OUTPUT_META
NvDsMetaType.NVDSINFER_TENSOR_OUTPUT_META
NvDsMetaType.NVDS_TRACKER_PAST_FRAME_META
NvDsMetaType.???
But i got the attribute error in the following line:
if user_meta and user_meta.base_meta.meta_type == pyds.NVDS_TRACKER_BATCH_REID_META:
AttributeError: module ‘pyds’ has no attribute ‘NVDS_TRACKER_BATCH_REID_META’
Is it because the pyds object has not integrated this meta_type in wrapper implementation yet??