Which class id cross the line into NvDsAnalytics?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Nano
• DeepStream Version 6.0
• JetPack Version (valid for Jetson only) 4.6.3

I’m using NvDsAnalytics to count bus, car, trucks, etc.

Into “deepstream_nvdsanalytics_meta.cpp” file, I can get the “LineCrossing Current Frame” direction (Entry or Exit) and it working well.

But the problem is to get the right class who cross the line.

I get the class id thanks “NvDsObjectMeta” but on a frame, I can have 2 cars and 3 trucks.

How can I get the class id, ie the right vehicle, who cross the line?

Thanks for your help.

there is only one detection model in this sample, if want to get the vehicle 's type, please add classification model. please refer to deepstream native sample deepstream_test2.

You are right and I forgot to say that I have change the neural network.
I’m currently detecting somes vehicules.

Hi all.

I still looking for know who cross the line…

I have found a link How to separate line crossing counts based on object classes in nvdsanalytics test application:

  • std::unordered_map<int, uint32_t> objCnt count each class detected on the current frame without identify the class who cross the line.
  • the code into “deepstream-test1” do the same thanks NvDsObjectMeta.

Is there any way to know which class id cross the line?

sorry for the late reply, Is this still an DeepStream issue to support?

No worries for the delay. It’s still a needed to know who cross the line into DeepStream / NvDsAnalytics.

please refer to NvDsAnalyticsObjInfo’s lcStatus, which means /** Holds the array of line crossing labels which object has crossed */

you might refer to sample : opt\nvidia\deepstream\deepstream\sources\apps\sample_apps\deepstream-nvdsanalytics-test

Thanks for your reply. I have already cheched this NvDsAnalyticsObjInfo.lcStatus and it contains the name of the crossed line. In my case, it print “Entry” or “Exit” and not the class id of the object who cross the line.

please refer to nvdsanalytics_src_pad_buffer_probe
in deepstream_nvdsanalytics_test.cpp, NvDsAnalyticsObjInfo is attached in object meta as user meta, so you might get class_id in object meta, and get the line name in NvDsAnalyticsObjInfo.

You are right, there is the “class_id” into “NvDsObjectMeta” but this contains all the “class_id” detected on the frame and not the “class_id” who cross the line.

all objects have own “class_id”, some of them will have lcStatus value if cross the line, some of them will not have lcStatus value if didn’t cross the line, so you can know which class_id cross the line. for example, there are two persons(AB) and two cars(C,D) in one frame, only C crossed the line. the meta should look like:
A, B,C(cross), D. then you can know class-id of car cross the line.

Hi @fanzh,
you are right! Thanks for your help!