Understanding DIoU Loss — A Quick Read

Original article was published on Deep Learning on Medium

1. IoU: A History

IoU loss function is a bounding box regression function that is scale-invariant.An improvement from the l2-norm loss function.

Fig: 0

It was perfect for overlapping boxes but suffered vanishing gradient problem due to non-overlapping boxes.

1.1 Prerequisite: Flaws of GIoU Loss

GIoU is a loss[2] function that has a penalty term along with the IoU loss function(1-IoU), where C is the smallest box covering B(predicted bounding box) and B_gt(ground truth bounding box).

Fig. 1 GIoU : Source: [Link]

Due to the introduction of the penalty term, GIoU loss keeps expanding the size of the predicted box until it overlaps with the target box(Fig. 2 up to 100th iteration), and then the IoU term will work to maximize the overlap area of the bounding box.

Fig. 2: Source: [Link]

Fig. 2 shows that GIoU first degrades to the IoU loss function followed by IoU loss iteration which slows down the convergence.

Fig. 3: Horizontal stretch: Source:[Link]
Fig. 4: Vertical stretch: Source:[Link]

We can observe from Fig. 3 that Even after 250 iterations predicted box expanded to overlap the ground truth and only little displacement in the co-ordinate of the center of the prediction box. Such is the case with vertical stretch in Fig. 4 too. Hence GIoU loss has slow convergence especially for the boxes at horizontal and vertical orientations.

GIoU: A tedious remedy to non overlapping bounding boxes