WongKinYiu / ScaledYOLOv4

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

[Question] max_batches for YOLOv4-CSP with a custom dataset #160

Open aparico opened 3 years ago

aparico commented 3 years ago

Question: What is the correct max_batches for YOLOv4-CSP for training with a custom dataset?

I have trained darknet's YOLOv4-CSP using a ~1000 custom dataset (1 class) using Colab's Tesla T4 (single GPU). But based on the results and config below, it seems like max_batches=6000 is not enough for YOLOv4-CSP. Is it normal to have >10 ave loss for YOLOv4-CSP?

I tried the following input images separately for each model: 512x512, 608x608

For YOLOv4-CSP, I used the suggested config file YOLOv4-CSP config except:

subdivisions=16
max_batches = {max_batches}
policy=steps
steps={steps_str}
random=0

where:
num_classes = 1
max_batches = num_classes*6000
steps1 = .8 * max_batches
steps2 = .9 * max_batches
steps_str = str(steps1)+','+str(steps2)

I followed this guide from the darknet repo for the max_batches: change line max_batches to (classes*2000 but not less than number of training images, but not less than number of training images and not less than 6000), f.e. max_batches=6000 if you train for 3 classes

And here are the results for the loss-mAP curve image

LukeAI commented 3 years ago

if mAP still hasn't levelled off, (as in your case) then train for longer - actual values for loss and mAP and when that happens will be different for different datasets