Overlapping Bounding Box Coordinates

Hi,

I am trying to implement NMS (Non-Maxima Suppression) to solve the issue of multiple and overlapping bounding box when detecting an object. But, the NMS function that I am using require a list of bounding boxes as an input.

This is the NMS function that I am referring to,

However, the output that that I obtain from net.Detect are as shown below, which are not in the format that I can feed into the NMS function.

detect.net output

So, my questions are:

  • How can I get all of the overlapping bounding boxes in a “LIST”? So that I can feed into the NMS function and ensure it works as expected.
  • Is there any other method to apply NMS? Maybe via Jetson Inference Package or something?

Thank you.

Hi,

detectNet do implement a non-maximal suppression itself.

To get the whole overlapping bbox, you can set numDetections += 1; to following line:
https://github.com/dusty-nv/jetson-inference/blob/master/c/detectNet.cpp#L856

This indicates always add the detections to the array without suppression.

Thanks.

I am sorry, but this a sample from my detection output. I am using a custom model and not running the detection model via a docker container.

In the picture below are a few lines of my codes for this application. Line 44 is where I called the net.Detect function.

You may want to decrease the clustering overlap threshold on this line of code:

https://github.com/dusty-nv/jetson-inference/blob/2fb798e3e4895b51ce7315826297cf321f4bd577/c/detectNet.h#L477

Then re-run make && sudo make install

You can use list comprehension to make it:

box_list = [(det.Left, det.Top, det.Right, det.Bottom) for det in detections]

(this is assuming your NMS function also expects the bounding box in (Left, Top, Right, Bottom) coordinate order)

Hi dusty,

Thank you so much! both of your recommendation works!

The easiest solution is by decreasing the clustering overlap threshold. I lowered the value down to 0.5 and the results are very good for me. TRUST ME, Applying another/external NMS might work at a certain level, but it is much troublesome to reach a stage just to ensure it work as expected.