12. Non-Maximum Suppression (NMS) algorithm
After the model training is completed, the network predicts bounding box offsets and corresponding categories. In some cases, two or more bounding boxes refer to the same object creating redundant predictions. The situation is shown in the case of a Soda can in Figure 11.12.1. To remove redundant predictions, a NMS algorithm is called. In this book, both classic NMS and soft NMS [6] are covered as shown in Algorithm 11.12.1. Both algorithms assume that bounding boxes and the corresponding confidence scores or probabilities are known.
Figure 11.12.1 The network predicted two overlapping bounding boxes for the Soda can object. Only one valid bounding box is chosen and that is the one with the higher score of 0.99.
In classic NMS, the final bounding boxes are selected based on probabilities and stored in list and with corresponding scores . All bounding boxes and corresponding probabilities are stored in initial lists and . In...