Hi,
I am trying to limit the creation of kitti-track-output-dir files, I would like that only those with object IDs are dumped on the output. How do I do this?
HEre is the deepstream-app code which I am modifying. From here I am already able to limit the kitti-track-output to those with detections only:
/**
* Function to dump bounding box data in kitti format with tracking ID added.
* For this to work, property "kitti-track-output-dir" must be set in configuration file.
* Data of different sources and frames is dumped in separate file.
*/
static void
write_kitti_track_output (AppCtx * appCtx, NvDsBatchMeta * batch_meta)
{
gchar bbox_file[1024] = { 0 };
FILE *bbox_params_dump_file = NULL;
if (!appCtx->config.kitti_track_dir_path)
return;
for (NvDsMetaList * l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
NvDsFrameMeta *frame_meta = l_frame->data;
guint stream_id = frame_meta->pad_index;
g_snprintf (bbox_file, sizeof (bbox_file) - 1,
"%s/%02u_%03u_%06lu.txt", appCtx->config.kitti_track_dir_path,
appCtx->index, stream_id, (gulong) frame_meta->frame_num);
NvDsMetaList * l_obj1 = frame_meta->obj_meta_list;
if(l_obj1 != NULL){ #this is where i am able to limit dump file for those with object detection
bbox_params_dump_file = fopen (bbox_file, "w");
if (!bbox_params_dump_file)
continue;
for (NvDsMetaList * l_obj = frame_meta->obj_meta_list; l_obj != NULL;
l_obj = l_obj->next) {
NvDsObjectMeta *obj = (NvDsObjectMeta *) l_obj->data;
int left = obj->rect_params.left;
int top = obj->rect_params.top;
int right = left + obj->rect_params.width;
int bottom = top + obj->rect_params.height;
guint64 id = obj->object_id;
fprintf (bbox_params_dump_file,
"%s %lu 0.0 0 0.0 %d.00 %d.00 %d.00 %d.00 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n",
obj->obj_label, id, left, top, right, bottom);
}
fclose (bbox_params_dump_file);}
}
}
I would like that only those with object IDs are dumped on the output
NvDsMetaList * l_obj1 = frame_meta->obj_meta_list;
if(l_obj1 != NULL){ #this is where i am able to limit dump file for those with object detection
I think every object detected has object_id.
Hi Chris,
What happens is that when there is object detection, sometimes retains the object_id but yes, most of the time, provides a different object_id. Such that, the actual object will have several object_ids and the dump file reflects this as well.
So, how do we proceed in eliminating the multiple/unnecessary object_ids?
object_id is provided by tracker. You can try to use mot_iou or nvdcf tracker.
[tracker]
enable=1
tracker-width=640
tracker-height=368
#ll-lib-file=/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_mot_iou.so
#ll-lib-file=/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_nvdcf.so
ll-lib-file=/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_mot_klt.so
#ll-config-file required for DCF/IOU only
#ll-config-file=tracker_config.yml
#ll-config-file=iou_config.txt
gpu-id=0
#enable-batch-process applicable to DCF only
enable-batch-process=1
You will have to implement mapping where only unseen or new objects (based on object_id) will be written to the file.
I was able to use nvdcf tracker and it reduced the number of object ids being created, however, there is still excess.
What do you mean by mapping? How do I implement such if my particular application is loading car dashcam videos and counting utility poles. Currently my output is that on a certain route when there are only around 30 poles, the object ID reaches 60(using nvdcf).
If I am only doing object counting. Would the mapping be like drawing a line on the frame and when an object intercepts, it then becomes the officially counted?
1 Like
do you think I should get more samples for my model to improve tracking and therefore reduce additional object ID creation? Are there tracking parameters on the nvdcf/iou that I can modify/calibrate to improve on this?
1 Like
Yes, for example in deepstream sample, here:
/opt/nvidia/deepstream/deepstream-5.1/sources/deepstream_python_apps/apps/deepstream-test2
Your have the files dstest2_tracker_config.txt
and tracker_config.yml
that you can modify.
These sample is in Python, but if you want in C language, you have in this directory:
/opt/nvidia/deepstream/deepstream-5.1/sources/apps/sample_apps/deepstream-test2
Good luck ;)
1 Like