2023. 4. 21. 05:59ㆍML
IoU
IoU is Intersection over Union. Let's we have two overlappig boxes.
$IoU = \frac{Intersection}{Union} = \frac{Intersection}{Area1 + Area2 - Intersction}$.
When two bounding boxes perfectly match, IoU = 1. When two boxes are far away, IoU=0.
IoU of two boxes is $\frac{0.25}{1.75}$. If IoU is 1, two boxes is same. So IoU means how similar the two boxes are.
However IoU has a plateau making it infeasible to optimize in the case of nonoverlapping bounding boxes.
GIOU
GIoU is generalized IoU. Let's add one minimum box contain two boxes.
$IoU = IoU - \frac{AreaC - Union}{AreaC}$.
When two bounding boxes perfectly match, GIoU = 1. When two boxes are far away, GIoU=0.
GIoU of two boxes is $\frac{0.25}{1.75} - \frac{2.25 - 1.75}{2.25} = -\frac{5}{63}$.
However GIoU suffer from the problems of slow convergence and inaccurate regression.
DIoU
DIoU is Distance-IoU. Let's add two diagonal lines of Intersection box and Cbox.
$DIoU = IoU - \frac{p^{2}}{c^{2}}$.
c is euclidean distance minmax points of Cbox, p is euclidean distance of center points of two boxes.
When two bounding boxes perfectly match, DIoU = 1. When two boxes are far away, DIoU=0.
DIoU of two boxes is $\frac{0.25}{1.75} - \frac{0.5}{4.5} = \frac{2}{63}$
And we can add aspect ratio to DIoU.
CIoU
CIoU is Complete IoU. It based on DIoU.
$CIoU = IoU - (\frac{p^{2}}{c^{2}} + \alpha v)$.
$v=\frac{4}{\pi}(\arctan\frac{w_{1}}{h_{1}} - \arctan\frac{w_{2}}{h_{2}})^{2}$.
$\alpha = \frac{v}{(1 - IoU) + v}$.
When two bounding boxes perfectly match, CIoU = 1. When two boxes are far away, CIoU=0.
CIoU of two boxes is $\frac{0.25}{1.75} - (\frac{0.5}{4.5} + \alpha v)$.
$v = \frac{4}{\pi}(\arctan\frac{1}{1} - \arctan\frac{1}{1})^{2} = 0, \alpha = 0$
So CIoU of boxes is $\frac{0.25}{1.75} - (\frac{0.5}{4.5} + 0) = \frac{2}{63}$
Code
Reference
GIoU: https://arxiv.org/pdf/1902.09630.pdf
DIoU, CIoU: https://arxiv.org/pdf/1911.08287.pdf
'ML' 카테고리의 다른 글
Global average Pooling (0) | 2022.10.24 |
---|