Understanding DIoU-NMS: An Advanced Suppression Technique for Object Detection

If you are familiar with object detection, you may have heard of non-maximum suppression (NMS), a process used to remove duplicate bounding boxes from detection outputs. But what is DIoU-NMS and how does it improve upon traditional NMS? Let's take a closer look.

The Problem with Traditional NMS

Traditional NMS relies on the intersection over union (IoU) metric to determine which bounding boxes to keep and which to discard. IoU calculates the overlap between two bounding boxes as the ratio of the intersection area to the union area between them. If two or more detection outputs have an IoU greater than a certain threshold (typically 0.5 or 0.6), only the detection output with the highest confidence score is kept, and the rest are discarded as redundant.

While traditional NMS works well in many cases, it can fail in the presence of occlusion, where objects partially block each other. In situations where multiple objects are crowded or overlapping, traditional NMS can mistakenly remove some of the objects because their overlapping regions exceed the IoU threshold, even though they are distinct objects. Therefore, there is a need for an improved NMS process that can handle these cases.

Introducing DIoU-NMS

DIoU-NMS is an enhanced version of NMS that uses a new metric, called Distance IoU (DIoU), to calculate the distance between the central points of the bounding boxes being compared. DIoU takes into account both the overlap area and the distance between the box centers, which improves the accuracy of suppression and reduces the number of false positives.

Given two bounding boxes A and B, the DIoU distance is calculated as follows:

DIoU formula

Where A and B are the two bounding boxes being compared, and wover, hover, wA, hA, wB, and hB are the width and height of the overlap area and the individual bounding boxes, respectively. Finally, dcenter is the Euclidean distance between the centers of A and B:

DIoU distance formula

DIoU ranges from -1 to 1, where 1 represents the case where the bounding boxes are identical, 0 represents the case where the bounding boxes only intersect, and -1 represents the case where there is no overlap between the boxes. A higher DIoU value implies a more significant overlap area and a smaller central point distance, indicating that the boxes are closely related.

How Does DIoU-NMS Work?

The DIoU-NMS algorithm is a modified version of traditional NMS that takes into account both the confidence score and the DIoU distance between bounding boxes. The general steps are as follows:

  1. Sort the detection outputs in descending order based on their confidence scores. The detection output with the highest score is considered the best candidate.
  2. For each remaining detection output in the list, calculate its DIoU distance with the best candidate box. If the DIoU distance is greater than a certain threshold (often 0.5 or 0.6), remove the detection output from the list; otherwise, keep it.
  3. Repeat step 2 for all other remaining detection outputs in the list.

After these steps, the final list of detection outputs represents the objects in the image with the highest confidence scores and minimal redundancy. In contrast to traditional NMS, DIoU-NMS can handle cases where objects are crowded, overlapping, or partially occluded, leading to more accurate results.

Benefits of DIoU-NMS

DIoU-NMS is a powerful technique that can enhance the performance of object detection models. Using DIoU distance instead of IoU as a metric for suppression can improve detection accuracy, especially for crowded scenes where traditional NMS may fail. Here are some benefits of using DIoU-NMS:

  • Improved accuracy: DIoU-NMS is more accurate than traditional NMS because it considers both the overlap area and the central point distance between objects, leading to fewer false positives.
  • Robustness: DIoU-NMS can handle cases where objects are crowded or partially occluded, making it more robust than traditional NMS.
  • Compatibility: DIoU-NMS can be easily integrated with existing object detection models without the need for significant changes.
  • Efficiency: Despite its enhanced capabilities, DIoU-NMS is computationally efficient and does not add significant overhead to the inference time of object detection models.

DIoU-NMS is a powerful improvement over traditional NMS that can enhance the accuracy and robustness of object detection models. By using DIoU distance instead of IoU as a metric for suppression, DIoU-NMS can handle cases where traditional NMS fails due to occlusion or crowding. DIoU-NMS is an efficient and easy-to-implement technique that can improve detection performance without significant changes to the model architecture or inference time. As object detection continues to play a crucial role in computer vision, techniques like DIoU-NMS will play an ever-increasing role in improving model accuracy and robustness.

Great! Next, complete checkout for full access to SERP AI.
Welcome back! You've successfully signed in.
You've successfully subscribed to SERP AI.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.