Deep Learning/Object Detection

(prerequisite-R-CNN) Non-maximum Suppression(NMS)

Naranjito 2024. 1. 23. 13:09
  • Non-maximum Suppression (NMS)

 

 

A technique that’s used after the region proposal step to eliminate duplicate bounding boxes and select the most relevant ones. The idea behind NMS is straightforward. It works by comparing the confidence scores of the proposed bounding boxes and eliminating the ones that overlap significantly with a higher-scoring bounding box.

 

 

https://www.jeremyjordan.me/object-detection-one-stage/


  • Algorithm of Non-maximum Suppression (NMS)

 

 

Input: A list of Proposal boxes B, corresponding confidence scores S and overlap threshold N.

Output: A list of filtered proposals D.

Algorithm:

  1. Select the proposal with highest confidence score, remove it from B and add it to the final proposal list D. (Initially D is empty).
  2. Now compare this proposal with all the proposals — calculate the IOU (Intersection over Union) of this proposal with every other proposal. If the IOU is greater than the threshold N, remove that proposal from B.
  3. Again take the proposal with the highest confidence from the remaining proposals in B and remove it from B and add it to D.
  4. Once again calculate the IOU of this proposal with all the proposals in B and eliminate the boxes which have high IOU than threshold.
  5. This process is repeated until there are no more proposals left in B.

  • Soft-NMS

 

 

Using NMS, the pink car detection will most likely be removed as it overlap significantly with the black car and has a lower confidence score.
How could we improve over the NMS algorithm to avoid this?
Well, it would be great to reduce the confidence score of the pink car instead of removing it.

  • Algorithm of Soft-Non-maximum Suppression (Soft-NMS)

 

Instead of discarding the lower confidence bounding boxes, keep them and decrease their confidence score.

This is just one line change in the implementation of NMS algorithm and it increases the precision to a good extent.

 

 

https://www.youtube.com/watch?v=wSJ4v1rrMF0

https://freedium.cfd/https://towardsdatascience.com/non-maximum-suppression-nms-93ce178e177c