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

small objects yolov4-csp #8081

Open tcdnm opened 3 years ago

tcdnm commented 3 years ago

Hi @AlexeyAB,

Do you have any suggestions on how to modify yolov4-csp .cfg to train for small objects? I've been trying to use the modifications suggested for yolov4 but they don't seem to work for yolov4-csp (it fails when setting the stride values to 4).

Here are the modifications I made to the original yolov4-csp.cfg file: set layers = 23 instead of https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-csp.cfg#L938 set stride=4 instead of https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-csp.cfg#L935 set stride=4 instead of https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-csp.cfg#L1059

Issue: image

Run parameters: image

vtyw commented 2 years ago

I have the same question, but I'm also wondering why increasing the stride is recommended for detecting small objects. Doesn't that result in downsampling of an activation map?

vtyw commented 2 years ago

@tcdnm I've figured it out, the way to do this for yolo4-csp.cfg is to set: Line 935: stride=4 Line 938: layers = 17 Line 1059: stride = 4 I've tested this and it does increase accuracy. However, it also makes the network slower so you may want to weigh this up compared to setting a larger input size without this modification, which may also increase accuracy while being slower.

Avv22 commented 1 year ago

@vtyw. How about your question please, "I have the same question, but I'm also wondering why increasing the stride is recommended for detecting small objects. Doesn't that result in downsampling of an activation map?" Where did you bring this from that "I'm also wondering why increasing the stride is recommended for detecting small objects"? Can you please add reference?

Avv22 commented 1 year ago

Can you please add more details what do you mean?