arXiv:1911.08287Computer ScienceNov 2019

Manuscript Offprint

arXiv:1911.08287

Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression

Zhaohui Zheng, Ping Wang, Wei Liu, Jinze Li, Rongguang Ye, Dongwei Ren

Abstract

Bounding box regression is the crucial step in object detection. In existing methods, while ℓn\ell_{n}-norm loss is widely adopted for bounding box regression, it is not tailored to the evaluation metric, i.e., Intersection over Union (IoU). Recently, IoU loss and generalized IoU (GIoU) loss have been proposed to benefit the IoU metric, but still suffer from the problems of slow convergence and inaccurate regression. In this paper, we propose a Distance-IoU (DIoU) loss by incorporating the normalized distance between the predicted box and the target box, which converges much faster in training than IoU and GIoU losses. Furthermore, this paper summarizes three geometric factors in bounding box regression, i.e., overlap area, central point distance and aspect ratio, based on which a Complete IoU (CIoU) loss is proposed, thereby leading to faster convergence and better performance. By incorporating DIoU and CIoU losses into state-of-the-art object detection algorithms, e.g., YOLO v3, SSD and Faster R-CNN, we achieve notable performance gains in terms of not only IoU metric but also GIoU metric. Moreover, DIoU can be easily adopted into non-maximum suppression (NMS) to act as the criterion, further boosting performance improvement. The source code and trained models are available at https://github.com/Zzh-tju/DIoU.

Object detection is one of the key issues in computer vision tasks, and has received considerable research attention for decades (Redmon et al. 2016; Redmon and Farhadi 2018; Ren et al. 2015; He et al. 2017; Yang et al. 2018; Wang et al. 2019; 2018). Generally, existing object detection methods can be categorized as: one-stage detection, such as YOLO series (Redmon et al. 2016; Redmon and Farhadi 2017; 2018) and SSD (Liu et al. 2016; Fu et al. 2017), two-stage detection, such as R-CNN series (Girshick et al. 2014; Girshick 2015; Ren et al. 2015; He et al. 2017), and even multi-stage detection, such as Cascade R-CNN (Cai and Vasconcelos 2018). Despite of these different detection frameworks, bounding box regression is the crucial step to predict a rectangular box to locate the target object.

In terms of evaluation metric for bounding box regression,

Copyright © 2020, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved.

Figure

Figure 1: Bounding box regression steps by GIoU loss (first row) and DIoU loss (second row). Green and black denote target box and anchor box, respectively. Blue and red denote predicted boxes for GIoU loss and DIoU loss, respectively. GIoU loss generally increases the size of predicted box to overlap with target box, while DIoU loss directly minimizes normalized distance of central points.

Intersection over Union (IoU) is the most popular metric,

IoU=∣B∩Bgt∣∣B∪Bgt∣,(1)IoU=\frac{\left|B\cap B^{gt}\right|}{\left|B\cup B^{gt}\right|}, \tag{1}

where Bgt=(xgt,ygt,wgt,hgt)B^{gt} = (x^{gt}, y^{gt}, w^{gt}, h^{gt}) is the ground-truth, and B=(x,y,w,h)B = (x, y, w, h) is the predicted box. Conventionally, ℓn\ell_n-norm (e.g., n=1n = 1 or 2) loss is adopted on the coordinates of BB and BgtB^{gt} to measure the distance between bounding boxes (Redmon et al. 2016; Girshick 2015; Ren et al. 2015; He et al. 2017; Bae 2019). However, as suggested in (Yu et al. 2016; Rezatofighi et al. 2019), ℓn\ell_n-norm loss is not a suitable choice to obtain the optimal IoU metric. In (Rezatofighi et al. 2019), IoU loss is suggested to be adopted for improving the IoU metric,

LIoU=1−∣B∩Bgt∣∣B∪Bgt∣.(2)\mathcal{L}_{I o U}=1-\frac{\left|B\cap B^{g t}\right|}{\left|B\cup B^{g t}\right|}. \tag{2}

However, IoU loss only works when the bounding boxes have overlap, and would not provide any moving gradient for non-overlapping cases. And then generalized IoU loss (GIoU) (Rezatofighi et al. 2019) is proposed by adding a

Figure

LIoU=0.75\mathcal{L}_{IoU} = 0.75

LGIoU=0.75\mathcal{L}_{GIoU} = 0.75

LDIoU=0.81\mathcal{L}_{DIoU} = 0.81

LIoU=0.75\mathcal{L}_{IoU} = 0.75

LGIoU=0.75\mathcal{L}_{GIoU} = 0.75

LDIoU=0.77\mathcal{L}_{DIoU} = 0.77

LIoU=0.75\mathcal{L}_{IoU} = 0.75

LGIoU=0.75\mathcal{L}_{GIoU} = 0.75

LDIoU=0.75\mathcal{L}_{DIoU} = 0.75

Figure 2: GIoU loss degrades to IoU loss for these cases, while our DIoU loss is still distinguishable. Green and red denote target box and predicted box respectively.

penalty term,

LGIoU=1−IoU+∣C−B∪Bgt∣∣C∣,(3)\mathcal{L}_{G I o U}=1-I o U+\frac{|C-B\cup B^{g t}|}{|C|}, \tag{3}

where C is the smallest box covering B and BgtB^{gt}. Due to the introduction of penalty term, the predicted box will move towards the target box in non-overlapping cases.

Although GIoU can relieve the gradient vanishing problem for non-overlapping cases, it still has several limitations. By a simulation experiment (see Sec. Analysis to IoU and GIoU Losses for details), we can evaluate the performance of GIoU loss for various bounding box positions. As shown in Fig. 1, one can see that GIoU loss intends to increase the size of predicted box at first, making it have overlap with target box, and then the IoU term in Eqn. (3) will work to maximize the overlap area of bounding box. And from Fig. 2, GIoU loss will totally degrade to IoU loss for enclosing bounding boxes. Due to heavily relying on the IoU term, GIoU empirically needs more iterations to converge, especially for horizontal and vertical bounding boxes (see Fig. 4). Usually GIoU loss cannot well converge in the state-of-the-art detection algorithms, yielding inaccurate detection.

In this paper, we propose a Distance-IoU (DIoU) loss for bounding box regression. In particular, we simply add a penalty term on IoU loss to directly minimize the normalized distance between central points of two bounding boxes, leading to much faster convergence than GIoU loss. From Fig. 1, DIoU loss can be deployed to directly minimize the distance between two bounding boxes. And with only 120 iterations, the predicted box matches with the target box perfectly, while GIoU does not converge even after 400 iterations. Furthermore, we suggest that a good loss for bounding box regression should consider three important geometric measures, i.e., overlap area, central point distance and aspect ratio, which have been ignored for a long time. By combining these geometric measures, we further propose a Complete IoU (CIoU) loss for bounding box regression, leading to faster convergence and better performance than IoU and GIoU losses. The proposed losses can be easily incorporated into the state-of-the-art object detection algorithms. Moreover, DIoU can be employed as a criterion in non-maximum suppression (NMS), by which not only the overlap area but also the distance between central points of two bounding boxes are considered when suppressing redundant boxes, making it more robust for the cases with occlusions.

To evaluate our proposed methods, DIoU loss and CIoU loss are incorporated into several state-of-the-art detection algorithms including YOLO v3 (Redmon and Farhadi 2018), SSD (Liu et al. 2016) and Faster R-CNN (Ren et al. 2015), and are evaluated on two popular benchmark datasets PAS-CAL VOC 2007 (Everingham et al. 2010) and MS COCO 2017 (Lin et al. 2014).

The contribution of work is summarized as follows:

  1. A Distance-IoU loss, i.e., DIoU loss, is proposed for bounding box regression, which has faster convergence than IoU and GIoU losses.

  2. A Complete IoU loss, i.e., CIoU loss, is further proposed by considering three geometric measures, i.e., overlap area, central point distance and aspect ratio, which better describes the regression of rectangular boxes.

  3. DIoU is deployed in NMS, and is more robust than original NMS for suppressing redundant boxes.

  4. The proposed methods can be easily incorporated into the state-of-the-art detection algorithms, achieving notable performance gains.

Related Work

In this section, we briefly survey relevant works including object detection methods, loss function for bounding box regression and non-maximum suppression.

References (30)