NvdsTracker API sample

Hi,
Is there any sample which explains using tracker in c++ prog. [url]NVIDIA DeepStream SDK API Reference: Main Page in deepstream 4.0.

We don’t have tracker api sample now.

To get NvDsBatchMeta we have gst_buffer_get_nvds_batch_meta() function, similarly is there any function to get NvMOTTrackedObj details in prog? or else how can we get it?

I think it can’t get NvMOTTrackerObj directly. The tracker result is in metadata.
You can refer to [url]https://docs.nvidia.com/metropolis/deepstream/4.0/DeepStream_Plugin_Manual.pdf#[{“num”%3A68%2C"gen"%3A0}%2C{“name”%3A"XYZ"}%2C106%2C506%2C0][/url]
2.2 gst-nvtracker
2.2.6 NvDCF Low-Level Tracker

I went through the docs but I couldn’t find any answer. How can I get object tracker meta data? can you help me?

Hi,

In section 2.2.1 (Tracker) ,

Output
● Gst Buffer (provided as an input)
● NvDsBatchMeta (Updated by Gst-nvtrackerwith tracked object coordinates
and object IDs)

when I print object-id, it remains the same for all objects.

obj_id = 18446744073709551615
rect = 48	255	387	774	
class_id = 2
unique_id = 2
obj_id = 18446744073709551615
rect = 1416	216	252	756	
class_id = 2
unique_id = 2
obj_id = 18446744073709551615
rect = 1527	178	387	897

My config file,

[tracker]
enable=1
tracker-width=640
tracker-height=368
ll-lib-file=/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_nvdcf.so
gpu-id=0
enable-batch-process=1
ll-config-file=tracker_config.yml

tracker_config.yml,

%YAML:1.0

NvDCF:
  useBufferedOutput: 0

  maxTargetsPerStream: 100 # Max number of targets to track per stream. Recommended to set >10. Note: this value should account for the targets being tracked in shadow mode as well. Max value depends on the GPU memory capacity

  filterLr: 0.11 # learning rate for DCF filter in exponential moving average. Valid Range: [0.0, 1.0]
  gaussianSigma: 0.75 # Standard deviation for Gaussian for desired response when creating DCF filter
  minDetectorConfidence: 0.0 # If the confidence of a detector bbox is lower than this, then it won't be considered for tracking
  minTrackerConfidence: 0.6 # If the confidence of an object tracker is lower than this on the fly, then it will be tracked in shadow mode. Valid Range: [0.0, 1.0]
  featureImgSizeLevel: 1 # Size of a feature image. Valid range: {1, 2, 3, 4, 5}, from the smallest to the largest
  SearchRegionPaddingScale: 3 # Search region size. Determines how large the search region should be scaled from the target bbox.  Valid range: {1, 2, 3}, from the smallest to the largest
  maxShadowTrackingAge: 9        # Max length of shadow tracking (the shadow tracking age is incremented when (1) there's detector input yet no match or (2) tracker confidence is lower than minTrackerConfidence). Once reached, the tracker will be terminated.
  probationAge: 12                # Once the tracker age (incremented at every frame) reaches this, the tracker is considered to be valid
  earlyTerminationAge: 2         # Early termination age (in terms of shadow tracking age) during the probation period
  minVisibiilty4Tracking: 0.1    # If the visibility of the bbox of a tracker gets lower, then it will be terminated

How to get correct object id’s?

Hi,

any update on this?

How do you get your object-id ?

Can you check DeepStream_Plugin_Manual.pdf - 2.2.4 Custom Low-Level Library

NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);

	for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
			l_frame = l_frame->next) {

		NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
		int offset = 0;
		for (l_obj = frame_meta->obj_meta_list; l_obj != NULL; l_obj = l_obj->next) {
			obj_meta = (NvDsObjectMeta *) (l_obj->data);
			 const std::type_info& r2 = typeid(obj_meta);
		
			std::cout<<"obj_id = "<<<b>obj_meta->object_id</b><<std::endl;
}

I was facing the same issue with object-id, the mistake i made was i added the probe in source pad of nvinfer element. But object-id is set by nvtracker element so i should add the probe in source pad of nvtracker or other elements that are downstream to nvtracker.
you can resolve it by changing this code

infer_src_pad = gst_element_get_static_pad (pgie, "src");
  if (!infer_src_pad)
    g_print ("Unable to get source pad\n");
  else
    gst_pad_add_probe (infer_src_pad, GST_PAD_PROBE_TYPE_BUFFER,
        nvinfer_src_pad_buffer_probe, NULL, NULL);

to this code.

infer_src_pad = gst_element_get_static_pad (nvtracker, "src");
  if (!infer_src_pad)
    g_print ("Unable to get source pad\n");
  else
    gst_pad_add_probe (infer_src_pad, GST_PAD_PROBE_TYPE_BUFFER,
        nvinfer_src_pad_buffer_probe, NULL, NULL);
1 Like

Is there any option to detect all objects but track only Persons in deepstream-app (means tracking only particular gie class-id’s)?

Hey sumityadav,
May I know what is your use case and the benefit if only tracking a special object?

Thank you, @sumityadav! It worked also on Python DeepStream 5.0 API.
No problems were found when using NvDCF Tracker, but when I changed to IOU (and KLT, I guess), I was getting the same result as you in obj_id.