Nvdsanalytics inconsistent line crossings

Please provide complete information as applicable to your setup.

• Hardware Platform - dGPU - rtx4000 ADA
• DeepStream Version - 7.1
• TensorRT Version - v100300
• NVIDIA GPU Driver Version - 560.35.05
• Issue Type - question / bug?

We are seeing inconsistent line crossing behavior with both entries and exits at all of our installations. These inconsistencies take the form of missed entries/exits or doubled or tripled counts.

In order to verify, we captured 8 hours of video in situ and edited out all of the idle scenes producing a 15min crossing-dense video. We then streamed the edited video to the production pipeline. Through our monitoring interface, we then created a video with bounding boxes and line crossing counts “burned in” visually.

We manually reviewed and annotated all of the line crossing “misses”. Here is a link to a recording showing examples of missed counts.

This sample video appears to be low fps but that is an artifact of how we had to record the counts and the bounding boxes. In reality, the pipeline is running at a solid 15fps. The clip features excerpts of about 4 hours of traffic. It is incorrectly registering ~10-15% of all line crossings consistently.

A few notes:

  • We have rock solid detection and tracks (tracker-ids are not changing around the line crossings). We have confirmed the object localization and tracking accuracy stability externally. (We stream from the deepstream pipeline at the edge to our cloud infra and store full inference data separately. We are able to pull this data and use math to recreate the crossing in python
  • We’ve experimented extensively with extended and mode options to no avail
  • We understand there is a requirement to have an approach angle > 30deg. This is one of the reasons we later tested with multiple lines [1]
  • We are assuming the bottom center of the bbox is used for analytics calculations [1] [2]

As a test, we set up several line crossings in order to help us understand the behavior. In short, we have a “single” line-segment line crossing and a 5-segment multi-line crossing. Our understanding is that most entries or exits would cross both the “single” line and one of the “multi” line crossing segments.

It’s a little easier to see here (there are both entry and exit lines but only entry is shown here

[line-crossing-stream-0]
enable=1
mode=strict
extended=0
line-crossing-multixx-Entry-0=1055;521;919;668;902;652;936;683
line-crossing-multixx-Exit-0=783;814;919;668;936;683;902;652
line-crossing-multixx-Entry-1=1025;502;957;690;936;683;978;698
line-crossing-multixx-Exit-1=888;878;957;690;978;698;936;683
line-crossing-multixx-Entry-2=1007;497;1009;697;978;697;1040;697
line-crossing-multixx-Exit-2=1011;897;1009;697;1040;697;978;697
line-crossing-multixx-Entry-3=960;513;1055;689;1041;696;1069;681
line-crossing-multixx-Exit-3=1150;865;1055;689;1069;681;1041;696
line-crossing-multixx-Entry-4=950;517;1085;664;1068;680;1102;648
line-crossing-multixx-Exit-4=1220;811;1085;664;1102;648;1068;680
line-crossing-singlexx-Entry-5=999;450;1001;650;888;652;1114;649
line-crossing-singlexx-Exit-5=1004;850;1001;650;1114;649;888;652

Continuing the testing, we ran the crossing-dense video through the pipeline again and tested a config with both the single and 5-segment multiline. Long story short, even though the individual lines are short, we are registering line crossings at a high level on most of the very small segments. In the chart below, the green and yellow lines represent entries/exists for the single horizontal line in the drawing above. The blue and orange lines represent the sum of the entries/exits for all of the segments in the multi line.

Below are charts of just the 5-segment “multi” line


It appears to act like the detection lines are much longer than shown (image the detection lines extended further in both directions.)

This behavior is repeatable in multiple locations. Granted, we use the same deepstream pipeline and settings, base systems, system images, etc.

Any help would be greatly appreciated.

Thanks for the sharing! To reproduce this issue in the video you shared, could you share the original video and configuration file? Thanks! You can use forum private email. please click forum avatar → "personal messages’ → “view all personal messages” → “new message”.

Hi @fanzh, I sent you a private message with the requested information. Thanks!

Hello @fanzh !

I’m continuing discussion on @chip.ray behalf.

We’re doing some additional testing regarding monitoring tracked person path and we noticed that double/triple counts could happen due to Boundary box jitter on the detected object that is crossing the line. If it happens right at the moment of crossing, the bottom center point might be moved suddenly back on the other side of the line crossing and hence a double or even triple count can occur. Hence we’re wondering, if there are any hidden config options in nvdsanalytics (we can’t find anything about that in the official docs) where you could control:

  1. Tuning config parameters for how BB jitter/drifting is handled at line crossing?
  2. Trajectory Smoothing configuration? Our own visualizations showed that smoothing the path of a tracked object could correct for jitter and result in a clean, accurate line crossing, suggesting this as a potential algorithmic improvement. See attached images below.
  3. Refractory Period: To combat spurious counts from bounding box jitter, a “blocking” or “refractory” period could be done. This would ignore subsequent crossings from the same ID for a short duration after the first one, significantly reducing overcounting.

Also we would like to understand a bit better how the Nvidia tracker is set up internally, as we could visualize what it expects for the next box position - but the software is not open. Can you give us some insight on this as well?

Cheers,
Jernej

  1. @jernej.jerin Thanks for the sharing! In the original issue description, chip.ray reported a " line crossing misses" issue. I have replied the email. using the shared test video and configuration file, I am not able reproduce the issue. please refer to the simplified project and results. regarding the double counts issue, can you use the native deepstream-nvdsanalytics-test to reproduce this issue? if so, could you provide the test clip and configuration file? Thanks!
  2. nvdsanalytics plugin is open source. the path is /opt/nvidia/deepstream/deepstream/sources/gst-plugins/gst-nvdsanalytics/. there is no configuration for BB jitter.
  3. the low-level implementation of nvdsanalytics is closed source. AYK, the algorithm is based on the bboxes. from the Trajectory of the second screenshot, the bbox only stepped back once and The overall trend is moving forward. as written in the point 1, could you help to reproduce? Thanks!

Does the trajectory use the bottom center of the bbox? if the test video is the video chip.ray shared, could you share the cfg and point out the time when the double counts occurred? I will have a try. Thanks!

Hello @fanzh !

Confirming that bottom center of the person bbox was used for trajectory calculation.

In other Nvidia forum posts we came across parameter obj-cnt-win-in-ms. Further testing with various values from 15ms (which matches our video FPS rate), to 100ms we noticed that it improved the number of counts and sometimes reduced the double counts. How exactly is this parameter used in the internal implementation? We don’t really understand how such small differences in ms to object in window count could make an impact? I actually observed the following behaviour:

  1. Fast moving person crossing line → Lower ms, it detects better
  2. Slow moving person → Higher ms, it detects better

As the comments in the code shown, it means “Window in ms for obj count”. the default is 50. if the fps is 25, 50 equals the size of 2 seconds.

Hi @fanzh !

We were extensively testing obj_cnt_win_in_ms parameter and came across parser bug in nvdsanalytics implementation, see this line:

obj_cnt_win_in_ms = g_key_file_get_integer (key_file, DSANALYTICS_PROPERTY, DSANALYTICS_PROPERTY_OBJ_CNT_WIN_MS, &error); CHECK_IF_PRESENT (error, DSANALYTICS_PROPERTY); if (!error) { CHECK_INT_VALUE_RANGE (DSANALYTICS_PROPERTY_OBJ_CNT_WIN_MS, osd_mode, DSANALYTICS_PROPERTY, 1, 1000000000); }

You are passing in osd_mode value instead of obj_cnt_win_in_ms.

I guess it doesn’t affect the yaml parser as you don’t have the same bug there.

Thanks for the sharing! we will fix it.

The latest DeepStream 8.0 GA is released.