How to count total unique occurrences of a class?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU): Jetson AGX Xavier
• DeepStream Version: 5.0
• JetPack Version (valid for Jetson only): 4.4
• TensorRT Version: 7.1.3
• Issue Type( questions, new requirements, bugs): question

The example apps show the total counts of each class for each frame but not the accumulated total counts (exclude duplicated appearances). I want to keep track how many unique objects of a class appear in total so I think I need to use the tracker id to discard duplicated occurrences. In other words, when an object of class A appears in multiple frames, only its first occurrence contribute to the total count of class A.

I read from the nvdsmeta.h file that UNTRACKED_OBJECT_ID indicates that the object has not been tracked, I wonder if I can use it to detect first occurrence of an object? Say:

if(object_id == UNTRACKED_OBJECT_ID) // first occurrence 
   update count
else // subsequent occurrence, object_id is set to a value other than UNTRACKED_OBJECT_ID
   pass 

You can not use UNTRACKED_OBJECT_ID to detect first occurrence of an object, untracked objects meta data removed from the list after tracker.

Hi @amycao,

So what other option do I have to detect first occurrence of an object? Storing historical tracker-ids seems impractical for a pipeline that can run for hours or even days.

You will need to implement your own logic. Per class based history will need to be maintained - tracking ID will keep incrementing so you can store only the latest value