Non-max suppression and region proposals: tidying up detections
10 questions on removing duplicate detections with non-max suppression, probability and overlap thresholds, region proposals and why they save computation.
- 10 questions
- Stopwatch
- Instant feedback
Sample questions
Play now ↑Answers stay hidden. Start the quiz to play them.
Sample 1
Three boxes of one class have probabilities of 0.9 (A), 0.8 (B) and 0.6 (C). The overlap of B with A is 0.7, and of C with A is 0.1. The overlap threshold is 0.5 and the probability threshold is 0.5. Which boxes does non-max suppression keep?
- Only A
- A and C
- A, B and C
How it works
- One question per screen. An answer is final once sent.
- You see right away whether you were right, with a short explanation.
- The stopwatch runs: on equal scores, the faster player ranks first.
- Only your best attempt counts, so replaying is never risky.
About this quiz
A detector that scans an image is, in a sense, too good at its job. A single object produces a strong response not only at the perfect window position but also at several positions around it, so that one dog ends up wrapped in a cluster of near-identical boxes. If you reported all of them, your system would claim to see five dogs where there is one. The usual remedy has an awkward name, non-max suppression, but the idea is simple and a little like a talent contest: keep the best candidate, remove everything that is too similar to it, and repeat with what is left.
This quiz takes you through the procedure step by step. You will see what is done first, with the raw probabilities, and what the two thresholds are for, one deciding which boxes are worth considering at all and the other deciding which are duplicates of an accepted one. You will work through a small example with three boxes and two thresholds, deciding which survive. You will think about what happens to boxes that lie far from the accepted one, which may belong to a genuinely different object, and why the procedure is run separately for each class.
The second half deals with cost. A scanning detector applies its full deep network to every part of the image, though most regions plainly contain nothing of interest. One response is to run a cheap method first to propose regions where objects are likely, and then apply the heavy network only to those. A further step lets a network learn to propose regions, which allows the proposal and detection stages to be trained together from end to end. The questions ask what each design saves and what it changes.
Typical errors are worth knowing. People forget that suppression uses both a probability threshold and an overlap threshold, imagine that it removes all boxes near the best one regardless of overlap, and assume that proposals make detection less accurate when they chiefly make it faster. The two halves of the quiz share a theme: a good detection system is as much about what it chooses not to report or compute as about what it finds. Removing duplicates keeps the output honest, since a count of objects must not be inflated by repeated boxes. Skipping unpromising regions keeps the computation affordable, since time spent on empty sky or blank wall is time wasted. Both are examples of pipelines in which a simple, cheap step before or after the neural network makes the whole system practical, and they are worth studying as design patterns in their own right.
The quiz suits learners who have met bounding boxes and sliding windows, and practitioners who have seen a detector's output cleaned up and wonder how. There are 10 questions, each with an explanation, and it takes about four minutes.
Questions and answers
›How long does the quiz take?
About 3 to 4 minutes for 10 questions, at roughly 20 seconds each. An explanation follows every answer, including the worked example with three boxes.
›Do I need to know about detection already?
It helps to know what a bounding box is and how overlap between boxes is measured, which the quiz on intersection-over-union explains. The questions here recall those ideas briefly, and everything else is introduced as it is needed.
›Why does a detector produce duplicate boxes?
Scanning a trained network over an image yields a high probability for an object not only at the best-fitting window but also at nearby positions, since a window shifted by a few pixels still contains most of the object. The result is several overlapping boxes around the same object, each with its own probability.
›How does non-max suppression work?
For each class in turn, it evaluates the probability of an object at every location and throws away boxes below a probability threshold. It then accepts the box with the highest probability as a detection, and discards any other box whose overlap with it exceeds an overlap threshold. It repeats this with the boxes that remain until each box has been accepted or discarded.
›What are the two thresholds for?
The probability threshold removes weak candidates at the outset, so that boxes the network itself is unsure about are never reported. The overlap threshold decides when two boxes are close enough to be regarded as the same object, so that only the stronger one is kept. Typical values are around seven tenths for the first and one half for the second.
›Why does the procedure keep some boxes near the winner?
Only boxes whose overlap with the accepted box is above the threshold are discarded. A box that overlaps it only slightly may well belong to a different object of the same class, so it stays in the pool and can be accepted later, if it has the highest remaining probability.
›What are region proposals?
They are candidate regions of the image, chosen by a computationally cheap method such as a segmentation algorithm, that are more likely to contain objects than other parts of the image. The expensive network is then applied only to those regions, instead of the whole picture, which is the idea behind fast region-based detectors.
›How did later methods improve on proposals from a fixed algorithm?
By using a network to propose regions. A region proposal network picks out the most promising regions, and this can be trained end to end together with the network that detects and localises objects within them. This allows the two stages to be tuned jointly, and detection becomes both quicker and more accurate than with a fixed proposal method.