How to access the object ID

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson
• DeepStream Version 6.2
• JetPack Version (valid for Jetson only) 5.1.1
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

I am using the nvdsanalytics example. I want to access the IDs of the objects that are inside the ROI. How can I do that?

there is object rect information is object meta, you can compare the coordinates between the object and roi. then you can know which object is inside the roi.

Based on the information you provided, it seems you are using DeepStream version 6.2 on a Jetson hardware platform with JetPack version 5.1.1. Unfortunately, you did not mention the TensorRT version or the NVIDIA GPU driver version.

Regarding your question about accessing the IDs of objects inside the Region of Interest (ROI) in the nvdsanalytics example, you can achieve that by modifying the source code. Here’s an overview of the steps you can follow:

  1. Locate the process_meta function in the nvdsanalytics.cpp file. This function is responsible for processing metadata for each frame.
  2. Inside the process_meta function, you’ll find a loop that iterates through each object within the frame. Typically, this loop starts with the following line of code:

Within the loop, you can access the objects’ metadata, including their IDs, using the obj_meta_list field of the frame_meta structure. Here’s an example of how you can access the ID:
for (NvDsMetaList *l_obj = frame_meta->obj_meta_list; l_obj != NULL; l_obj = l_obj->next)
NvDsObjectMeta *obj_meta = reinterpret_cast<NvDsObjectMeta *>(l_obj->data);
guint object_id = obj_meta->object_id;
// … (perform your desired operations with the object ID)

  1. Now, you can perform any additional operations you need with the object_id variable. For example, you can print it, store it in a data structure, or use it for further analysis.
  2. After making the necessary modifications, rebuild the nvdsanalytics example following the DeepStream SDK documentation for building DeepStream applications.

By accessing the object_id variable within the loop, you can retrieve the IDs of objects detected within the ROI in the nvdsanalytics example.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.