robokudo.utils.non_maxima_suppression

Implements Non-Maxima-Suppression (NMS).

Non-Maxima-Suppression (NMS) is a technique used to reduce the number of bounding boxes in an image. It is used to remove redundant overlapping boxes that are likely to be detections of the same object. This is done by selecting the box with the highest confidence score and removing all other boxes that overlap with it more than a given threshold. This process is repeated until there are no more boxes left.

Author: Lennart Heinbokel Created on: 2023-02-02

Functions

_iou(box1, box2)

Calculates the intersection over union of two bounding boxes

non_max_suppression_(predictions[, ...])

Performs non-maxima suppression (NMS) on inference results

class_based_nms(predictions[, confidence_threshold, ...])

Performs non-maximum suppression (NMS) on inference results, filtering only

Module Contents

robokudo.utils.non_maxima_suppression._iou(box1, box2)

Calculates the intersection over union of two bounding boxes

Args:

box1: bounding box 1 box2: bounding box 2

Returns:

intersection over union of the two bounding boxes

robokudo.utils.non_maxima_suppression.non_max_suppression_(predictions, confidence_treshold=0.5, iou_threshold=0.4)

Performs non-maxima suppression (NMS) on inference results

Args:

predictions: list containing tuples of bounding boxes, class probabilities and class labels confidence_tresholdhold: confidence threshold for keeping bounding boxes iou_threshold: intersection over union threshold for indicating whether two boxes overlap

Returns:

list of non-max suppressed bounding boxes, class probabilities and class labels

robokudo.utils.non_maxima_suppression.class_based_nms(predictions, confidence_threshold=0.5, iou_threshold=0.4)
Performs non-maximum suppression (NMS) on inference results, filtering only

overlapping boxes of the same class. This is done to avoid removing boxes of different classes that overlap with each other.

Args:

predictions: list containing tuples of bounding boxes, class probabilities and class labels confidence_threshold: confidence threshold for keeping bounding boxes iou_threshold: intersection over union threshold for indicating whether two boxes overlap

Returns:

list of non-maximum suppressed bounding boxes, class probabilities and class labels