What is CIOU loss?
CIOU introduces two new concepts compared to IOU loss.
- The concept of centroid distance, which is the distance between the centroid of the actual bounding box and the centroid of the predicted bounding box. 
- The concept of comparing the aspect ratio of the actual bounding box with the aspect ratio of the predicted bounding box. 
Through those 3 measures, we can evaluate the quality of the predicted bounding box.
So, let’s see the formula for CIOU loss.
Formula of CIOU
$Loss_{CIoU}\ =\ 1\ -\ IoU\ +\ \frac{p^{2}(b,b^{gt})}{c^{2}}\ +\ \alpha v$
$Loss_{CIoU}\ =\ 1\ -\ \frac{Area\ of\ Overlap}{Area\ of\ Union}\ +\ \frac{p^{2}(b,b^{gt})}{c^{2}}\ +\ \alpha v $
where:
- $B^{gt} = (x^{gt}, y^{gt}, w^{gt}, h^{gt})$ is the ground-truth 
- $B = (x, y, w, h)$ is the predicted box. 
- $c$ = the diagonal length of the smallest bounding box. 
- $p$ = Euclidean distance. 
- $v = \frac{4}{\pi}(arctahn\frac{w^{gt}}{h^{gt}}\ -\ arctahn\frac{w}{h})^{2}$ = measures the consistency of the aspect ratio. 
- $\alpha= \frac{v}{(1\ -\ IoU) + v} = \frac{v}{(1\ -\ \frac{Area\ of\ Overlap}{Area\ of\ Union}) + v}$ 
