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

Added yolov4-csp-x-swish (69.9% / 51.5% AP) and yolov4-csp-swish (68.7% / 50.0% AP) models #7888

Open AlexeyAB opened 3 years ago

AlexeyAB commented 3 years ago

yolov4-csp-x-swish.cfg:
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.51519
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.69897
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.56023
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.35798
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.56758
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.66052
yolov4-csp-swish.cfg:
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.50004
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.68664
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.54351
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.34176
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.55132
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.64318

For Training - change these lines before each of 3 [yolo]-layers: https://github.com/AlexeyAB/darknet/blob/1be96802a030ae2216c7e19b7523e1e2f0948aaf/cfg/yolov4-csp-x-swish.cfg#L1533-L1534 filters=<(5 + num_classes) x 3> activation=logistic - for training and detection by using Darknet: https://github.com/AlexeyAB/darknet activation=linear - for training and detection by using Pytorch YOLOR: https://github.com/WongKinYiu/yolor

amish25 commented 3 years ago

Hi @AlexeyAB, for yolov4-csp-x-swish.cfg at 640x640, you state APsmall is 0.35798. From the YOLOv4 paper, at 608x608 res APsmall is 0.267. Does this suggest that yolov4-csp-x-swish is better than yolov4 at detecting small objects?

AlexeyAB commented 3 years ago

@amish25 Hi, Yes, at least if you use 640x640 or higher for yolov4-csp-x-swish.cfg then it is better for small objects than 608x608 for yolov4.cfg.

yolov4-csp-x-swish.cfg was validated on Pytorch, so I will validate it on Darknet too.

sctrueew commented 3 years ago

Hi @AlexeyAB,

Does Open-CV DNN support?

yolov4-p6 ? yolov4-csp-x-swish ? yolov4x-mish ?

Thanks

matt-sharp commented 3 years ago

Hi @AlexeyAB,

Does Open-CV DNN support?

yolov4-p6 ? yolov4-csp-x-swish ? yolov4x-mish ?

Thanks

Curious to know the answer to this also.

akashAD98 commented 3 years ago

Apart from the activation function have you done any other changes in cfg of yolov4-csp-swish? What are the key factors in which it's performing well compared to yolov4-mish & csp? @AlexeyAB

I have done inference on images & yolov4swish is detecting more objects with high confidence.

Yolov4x-mish yolov4x-mish

Yolov4-csp-swish yolov4-xswish

cpsu00 commented 3 years ago

Apart from the activation function have you done any other changes in cfg of yolov4-csp-swish? What are the key factors in which it's performing well compared to yolov4-mish & csp? @AlexeyAB

I have done inference on images & yolov4swish is detecting more objects with high confidence.

Yolov4x-mish yolov4x-mish

Yolov4-csp-swish yolov4-xswish

@AlexeyAB I'm also curious to know the key factors.

AlexeyAB commented 3 years ago

It was trained with representation layer on Pytorch, and then these layers were fused to conv.

akashAD98 commented 2 years ago

@AlexeyAB I tried swish on custom data performance of the swish model is far better than mish model. specially for detecting small objects (map of both mish & csp-swish model same is same). I have one question what is ema_alpha? when training of yolov4-csp-swish is completed ,we will get ema.weight. can you explain how should we tweak & what's purpose of this