argusswift / YOLOv4-pytorch

This is a pytorch repository of YOLOv4, attentive YOLOv4 and mobilenet YOLOv4 with PASCAL VOC and COCO
1.68k stars 330 forks source link

CIoU computation #214

Open a-haja opened 3 years ago

a-haja commented 3 years ago

I would like to ask about the computation of the CIoU. Based on https://www.programmersought.com/article/33648955485/ CIoU is defined as follows:

CIoU = 1 - IoU + dist(b, b_gt) / c*2 + alphav

However in the code: https://github.com/argusswift/YOLOv4-pytorch/blob/a0627679f38af811a8311a3d12213fe789ce1e6b/utils/tools.py#L283

Can you please explain why the formel looks different?

I found an implementation for the correct CIoU here https://github.com/VCasecnikovs/Yet-Another-YOLOv4-Pytorch/blob/2e18612e1852abbf35b4dac55a00f2a3b2d814ed/model.py#L527-L561

faresbs commented 3 years ago

I also found different variations of the ciou measurement but i also found that it is pretty much similar to what is done in the scaled yolov4 (https://github.com/WongKinYiu/ScaledYOLOv4/blob/yolov4-large/utils/general.py).