AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.65k stars 7.96k forks source link

What is the use of liner & sigmoid activation function in Darknet YOLOV4?? #7623

Open akashAD98 opened 3 years ago

akashAD98 commented 3 years ago

For detecting small & big objects as mentioned in this cfg file https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov4-custom.cfg we are using activation function as =linear above last [yolo] layer. & leaky activation function for all model.cfg

& in YOLOV4-CSP https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov4-csp.cfg we are using sigmoid activation function. in above last [yolo] layer, with mish as activation function . just want to know what are the reasons behind it ?? can I changed any activation function ?? what is the use of Linear & sigmoid in darknet yolov4

lsd1994 commented 3 years ago

For old net, we use activation=linear before yolo layer because we activate x,y,obj in yolo layer https://github.com/AlexeyAB/darknet/blob/96971deaa79e69b6deb1c77f546bf44bee2bf3f6/cfg/yolov4.cfg#L962 https://github.com/AlexeyAB/darknet/blob/96971deaa79e69b6deb1c77f546bf44bee2bf3f6/src/yolo_layer.c#L678-L680 But for yolov4csp yolov4xmish, we use new_coords=1 in yolo layer, which activate in conv layer rather than yolo layer. https://github.com/AlexeyAB/darknet/blob/96971deaa79e69b6deb1c77f546bf44bee2bf3f6/cfg/yolov4-csp.cfg#L1050 https://github.com/AlexeyAB/darknet/blob/96971deaa79e69b6deb1c77f546bf44bee2bf3f6/src/yolo_layer.c#L674-L676

akashAD98 commented 3 years ago

For old net, we use activation=linear before yolo layer because we activate x,y,obj in yolo layer https://github.com/AlexeyAB/darknet/blob/96971deaa79e69b6deb1c77f546bf44bee2bf3f6/cfg/yolov4.cfg#L962

https://github.com/AlexeyAB/darknet/blob/96971deaa79e69b6deb1c77f546bf44bee2bf3f6/src/yolo_layer.c#L678-L680

But for yolov4csp yolov4xmish, we use new_coords=1 in yolo layer, which activate in conv layer rather than yolo layer. https://github.com/AlexeyAB/darknet/blob/96971deaa79e69b6deb1c77f546bf44bee2bf3f6/cfg/yolov4-csp.cfg#L1050

https://github.com/AlexeyAB/darknet/blob/96971deaa79e69b6deb1c77f546bf44bee2bf3f6/src/yolo_layer.c#L674-L676 can you please explain me this (which activate in conv layer rather than yolo layer.) in details ? what is the impact of new_coord=1 ,its passing in all convolution layer??

lsd1994 commented 3 years ago

can you please explain me this (which activate in conv layer rather than yolo layer.) in details ?

We activate x,y,p for old net, and we activate them in yolo layer, so the conv layer before yolo layer doesn't be activated(linear). For now, we activate all outputs(x,y,w,h,p), so we just activate them in conv layer before the yolo layer, and we do nothing in yolo layer.

what is the impact of new_coord=1 ,its passing in all convolution layer??

No, just conv layer before yolo layer.

@akashAD98 @bulatnv