目标检测任务的损失函数由两部分构成:Classification Loss和Bounding Box Regeression Loss。关于Bounding Box Regression Loss Function,其演进路线是:
Smooth L1 Loss —
>
>
> IOU Loss —
>
>
> GIOU Loss —
>
>
> DIOU Loss —
>
>
> CIOU Loss
IoU
IoU有一些问题,最大的问题是:
However, IoU has a major weakness:
• If |A∩B| = 0, IoU(A, B) = 0. In this case, IoU does not reflect if two shapes are in vicinity of each other or very far from each other.
当box没有相交时,IoU Loss的梯度为0,无法训练。论文有几个地方都有描述:
- IoU loss only works when the bounding boxes have overlap, and would not provide any moving gradient for non-overlapping cases.
- It is easy to see that IoU loss only works for the cases of overlapping with target boxes.The anchor boxes without overlap will not move due to that ∇B is always 0.(∇B denotes the gradient of loss L)
Generalized IoU Loss (GIoU)
为了能缓解这个问题,GIoU加入惩罚项
where C is the smallest box covering B B B and B g t B^{gt} Bgt. Due to the introduction of penalty term, the predicted box will move towards the target box in non-overlapping cases.
但是,GIoU仍然还是存在一些问题
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.
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
Distance-IoU (DIoU):
Diou论文
DIoU继承了GIoU和IoU的一些特性,但是有一些是更好的地方,论文中的原话为:
And DIoU loss has several merits over IoU loss and GIoU loss, which can be evaluated by simulation experiment.
1.DIoU loss can directly minimize the distance of two boxes, and thus converges much faster than GIoU loss
2.For the cases with inclusion of two boxes, or in horizontal and vertical orientations, DIoU loss can make regression very fast, while GIoU loss has almost degraded to IoU loss
Complete IoU (CIoU) :
CIoU则考虑了三个因素:重叠面积,中心点的距离,长宽比,论文中的描述为:
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.