We will get many bounding boxes as the output of our detection. Some of these bounding boxes might be very similar and will have overlap. We need to decide which to keep.
We will only keep “peaks” in the detector response and discard low probability bounding boxes that are near high probability ones.
You can do this with a greedy algorithm:
Algorithm:
- Select next highest-scoring box
- Add it to your set of boxes to keep if it doesn’t significantly overlap any of your already selected boxes. Otherwise, discard.
- If any boxes remain, repeat from 1.
Problem: NMS may eliminate “good” boxes when objects are highly overlapping (like in the above image). There is no good solution to this problem yet.