WongKinYiu / ScaledYOLOv4

Scaled-YOLOv4: Scaling Cross Stage Partial Network
GNU General Public License v3.0
2.02k stars 575 forks source link

Does ScaledYOLOv4 use the same encoding of bounding box coordinates as YOLOv3 #90

Open songyuc opened 3 years ago

songyuc commented 3 years ago

Hi, guys, I want to know whether ScaledYOLOv4 uses the same encoding of bounding box coordinates as YOLOv3, like, image

Any answer or idea will be appreciated!

WongKinYiu commented 3 years ago

No, the encoding/decoding method is changed in yolov4. yolov4-tiny used same encoding/decoding method as yolov4. the encoding/decoding method is proposed by glenn, which solved the grid sensitivity problem. glenn further replaced exponential function by sigmoid function to avoid nan problem in training process. yolov4-csp and yolov4-large models use this new encoding/decoding method.

reference: https://github.com/AlexeyAB/darknet/issues/3293 https://github.com/AlexeyAB/darknet/issues/6987#issuecomment-729218069

songyuc commented 3 years ago

Hi, @WongKinYiu Today I read the code of ScaledYOLOv4, and translate the decoding as these formulas, image I hope you can give me more correction advices.

WongKinYiu commented 3 years ago

yes, the formulas are totally same as https://github.com/AlexeyAB/darknet/issues/6987#issuecomment-729218069

songyuc commented 3 years ago

@WongKinYiu , I am not sure about why there is a factor of 2. Is this factor of 2 would help mitigate the issue of sigmoid's gradiet vanishing?

saikrishnadas commented 3 years ago

So, Is it possible to use the same yolo annotations(.txt) as YOLOv4 darknet in Scaled-Yolov4?