Paper commentary
Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression
DIoU loss speeds up learning for bounding box regression
- Problem GIoU loss converges slowly on horizontal and vertical boxes, because its penalty term is often near zero.
- Method DIoU loss adds the normalized distance between the two box centers to the IoU loss, so the predicted box is pulled directly toward the target.
- Results CIoU loss with DIoU-NMS scores 49.32 AP on YOLO v3, against 46.57 for the IoU loss baseline.
Where IoU-based losses stall
Bounding box regression is judged by IoU, the overlap between the predicted box and the ground-truth box. A loss built as one minus IoU has no gradient when the two boxes don't overlap, so the predicted box has no direction to move. GIoU loss was introduced to fix this by adding a penalty based on C, the smallest box covering both boxes. That penalty gives non-overlapping boxes a direction to move, but it doesn't work equally well in every configuration.
Real benchmarks rarely cover distances, scales and aspect ratios in a controlled way, so the authors study the losses in a simulation. In that simulation GIoU first enlarges the predicted box until it overlaps the target, and only then does the IoU term shrink the error. For boxes that enclose each other, or for horizontal and vertical boxes, the penalty area is often near zero, so GIoU behaves almost like IoU loss.
GIoU still converges with enough iterations and suitable learning rates, but the authors describe that convergence as very slow. That leaves two questions: can the centers be pulled together directly, and how should overlap and inclusion be handled?
How the simulation tests each loss
The authors place anchor boxes at 5,000 points within a circle of radius 3 centered at (10, 10). The target boxes all have area 1 and seven aspect ratios, from 1:4 to 4:1, and their centers stay fixed at (10, 10). Each point gets seven scales and seven aspect ratios, which gives 1,715,000 regression cases.
Each case is regressed by gradient descent, with the predicted box updated at every iteration as follows. \[ B_i^t = B_i^{t-1} + \eta\,(2 - IoU_i^{t-1})\,\nabla B_i^{t-1} \] The gradient is multiplied by 2 minus the IoU, which the authors use to speed up convergence. The step size η is 0.1 up to 0.8T, 0.01 up to 0.9T and 0.001 after that.
Regression error is measured with the ℓ1 norm, and each run stops at T = 200 iterations.
DIoU loss adds a central distance penalty
The key idea is to keep the IoU term and add a penalty that pulls the two central points together. The penalty is the squared Euclidean distance between the two central points, divided by the squared diagonal c of the smallest box enclosing both boxes. \[ L_{DIoU} = 1 - IoU + \frac{\rho^2(b, b^{gt})}{c^2} \] Here b and b^gt are the central points of the predicted and target boxes.
Because the penalty depends on center distance, it still gives a moving direction for boxes that don't overlap, as GIoU does. The loss is zero when two boxes match perfectly, while for boxes that are far apart the GIoU and DIoU losses both approach 2. The authors expect faster convergence because DIoU minimizes the center distance directly, rather than through the overlap area.
The normalization by c keeps the penalty invariant to the scale of the regression problem, which the authors list as an inherited property.
CIoU adds an aspect ratio term
The authors argue that a good loss should use overlap area, central point distance and aspect ratio together. DIoU already covers overlap and center distance, so CIoU adds a consistency term for the aspect ratio. \[ L_{CIoU} = 1 - IoU + \frac{\rho^2(b, b^{gt})}{c^2} + \alpha v \] The term v compares the arctangents of the target and predicted width-to-height ratios, and a trade-off parameter alpha weights it.
Alpha is set from v and the IoU value, which gives overlap higher priority, especially for non-overlapping boxes. The gradient of v with respect to w and h has a denominator w² + h² that can be small for w and h in [0, 1], which may cause gradient explosion. The implementation therefore removes that denominator, which replaces the factor by 1 while keeping the gradient direction.
What the simulation shows for each loss
In the example of Fig. 1, the DIoU-regressed box matches the target after 120 iterations. The GIoU-regressed box has not converged even after 400 iterations, so the authors use this single example to argue that DIoU minimizes distance more directly. This is one illustrative case, not a count over all 1,715,000 regression cases.
Across the final error maps, IoU loss shows large errors for non-overlapping cases. GIoU loss shows large errors for horizontal and vertical cases, while DIoU loss leaves small errors across the grid. The summed error curves for IoU, GIoU, DIoU and CIoU are shown in Fig. 3(b), but the text gives no numeric values for them.
DIoU as the NMS criterion
Standard NMS removes a lower-scoring box once its overlap with the highest-scoring box passes a threshold. DIoU-NMS adds the central point distance to that test, so two boxes with distant centers are less likely to suppress each other.
The comparison covers YOLO v3 and SSD trained with CIoU loss over thresholds from 0.43 to 0.48. DIoU-NMS is better than original NMS at every threshold in that range, and its worst threshold is at least comparable to the best original NMS. The default thresholds are 0.45 for YOLO v3 and SSD and 0.50 for Faster R-CNN.
YOLO v3 and SSD on PASCAL VOC
YOLO v3 was trained on VOC 07+12, which contains 16,551 images, and tested on the 4,952 images of VOC 2007 test. The maximum training iteration is 50K, and the authors follow the GDarknet protocol. Under the IoU metric, DIoU loss raised AP by 3.29% and AP75 by 6.02% over the IoU loss baseline. CIoU loss with DIoU-NMS reached 49.32 AP, compared to 46.57 for the IoU baseline, which is a gain of 5.91% in AP.
The authors credit the larger CIoU gain to the added aspect ratio term.
SSD uses ResNet-50-FPN, and the regression loss weight is fixed at 5 for all IoU-based losses. DIoU loss reached 51.31 AP and 55.71 AP75, and CIoU loss reached 51.44 AP and 56.16 AP75. These are compared to 51.01 AP and 54.74 AP75 for the IoU loss baseline, so the gains on SSD are smaller than on YOLO v3.
Faster R-CNN on MS COCO and small objects
The regression loss weight is 12 for all losses, chosen for a fair comparison. CIoU loss reached 38.65 AP and 41.96 AP75, which the authors place among the clearer gains in this table. The authors explain the small GIoU gain by noting that Faster R-CNN regression cases tend to sit in the good basins of Fig. 4, where IoU already performs well.
DIoU loss scores 21.66 APsmall, which is higher than every other loss in that table. The authors suggest the aspect ratio term matters less for small objects, where center distance is more important. They also say the adverse effect can be relieved by DIoU-NMS, although CIoU with DIoU-NMS still scores 21.37 APsmall.
Limitations
The loss weights of 5 for SSD and 12 for Faster R-CNN were fixed for fairness rather than tuned for each loss. DIoU-NMS was compared with original NMS only over thresholds from 0.43 to 0.48.
The simulation uses unit-area target boxes at a single fixed center, so it doesn't cover every target size or position. On small objects, CIoU loss is slightly below IoU loss on APsmall, and the text doesn't test whether this holds for other object sizes. The CIoU gradient drops the w² + h² denominator as an implementation choice, and the effect of that choice isn't measured in the text.
Paper info
- Authors
- Zhaohui Zheng, Ping Wang, Wei Liu, Jinze Li, Rongguang Ye, Dongwei Ren
- Venue
- arXiv · Preprint
- First published
- 2019-11-19
- Added
- 2026-11-11
- Updated
- 2019-11-19
- Version
- v1
- arXiv
- 1911.08287
- Category
- cs.CV
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Zhaohui Zheng, Ping Wang, Wei Liu, Jinze Li, Rongguang Ye, Dongwei Ren (2019). Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression. arXiv:1911.08287v1. https://arxiv.org/abs/1911.08287v1
BibTeX
@misc{zheng2019distance,
title = {{Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression}},
author = {Zhaohui Zheng and Ping Wang and Wei Liu and Jinze Li and Rongguang Ye and Dongwei Ren},
year = {2019},
eprint = {1911.08287},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1911.08287v1}
}