Nvdsanayltics ROI logic

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) → Jetson
• DeepStream Version → 6.3
• JetPack Version (valid for Jetson only) → 5.1.2
• TensorRT Version → 8.5.2.2
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs) question
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description) Nvdsanalytics

Hi,

We need to edit the logic in the gst-nvdsanalytics plugin because right now “For all the analytics calculations bottom center coordinate of bounding box of an object is being used”. Because with this logic only the bottom center coordinate decides whether a person is inside the ROI or not.


Here you can see this doesn’t accept that the person is inside ROI because the bottom center coordinate wasn’t included.

We need to implement an excluded zone logic where only if a person’s bbox intersection percentage (which is bbox area intersection with the excluded zone) exceeds a certain value we consider him to be inside the excluded zone.

How can I find the logic for this behaviour gst-nvdsanalytics file, can I edit the existing plugin for this or will I have to create a custom plugin?

please refer to this topic.

1 Like

thanks ! I followed those topics and have few questions.

Can you explain more on how to replace the low level lib for the NVDSananlytics plugin instead of creating a custom plugin? Modifying just the Gst-nvdsanalytics opensource plugin won’t solve the problem.

What are the steps that I should take? Where should I keep the low level lib file after creating a one.

thanks

custom center point is not supported by the current low-level lib. you only need to modify NVDSananlytics plugin, that is, replace your own algorithm lib, not create a new ananlytics plugin. you can put the new so to /opt/nvidia/deepstream/deepstream/lib, which is same with libnvds_dsanalytics.so.

this isn’t what I want, I want to compare the intersection areas of the bbox with ROI area.

For this can I just create my own algorithm and add a seperate .so file because if I’m replacing the current libnvds_dsanalytics.so file I have to replace all the other functionalities as well right?

I just want to replace the logic where it decides to count that a person is inside ROI using the bottom center coordinate to my own logic.

Also, can you explain what are the functions there are inside the internal lib file in nvds_analytics. So that I know what are the functions that I have to replicate if I’m creating my own lib file.

thank you

NVDSananlytics plugin will call processSource in gst_nvdsanalytics_transform_ip to do analysis.
if you only need ROI feature, you can comment out this processSource. then use your own ROI algorithm.
if you need own ROI algorithm while using other features of NV analysis low-level lib(such as Line Crossing), first you can set ROI’s “enable” to false, then low-level lib will not do ROI analysis. second you need to add own ROI checking code after processSource.

1 Like

Thank you very much for the previous answer.

I created a dsanalytics_lib directory and made a cpp file which overrides the processSource function
I managed to replace the processSource function with another function, and compiled it in to a static lib file. I checked the gst-dsexample and followed that path.

My question is where should I put this lib file?
is it /opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/gst-plugins/ ?
Then what does /opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/ directory contains?

In the /opt/nvidia/deepstream/deepstream-6.3/lib directory it has libnvds_dsanalytics.so file.
And in the /opt/nvidia/deepstream/deepstream-6.3/lib/gst-plugins directory it has libnvdsgst_dsanalytics.so , can you explain what are these two.

libnvdsgst_dsanalytics.so is the plugin lib. libnvds_dsanalytics.so is the low-level lib, which is called by plugin.

1 Like

I edited the plugin and created a new low-level lib file, So I should replace both those files with new .so files of them right?

libnvdsgst_dsanalytics.so needs to be replace because the code is updated. if you create a new low-level lib, you can name a different name with libnvds_dsanalytics.so, then copy the new so to …/deepstream-$(NVDS_VERSION)/lib/ .

Here is a sample to customize ROI check strategy while other functionalities still can work. the code will do ROI check in plugin and the low-level lib will not do ROI check. you can continue to apply your own ROI logic. especially please replace /opt/nvidia/deepstream/deepstream/lib/gst-plugins/libnvdsgst_dsanalytics.so with the new so after rebuild the code. gstnvdsanalytics.cpp.diff (3.5 KB) makefile.diff (148 Bytes)

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