Fork me on GitHub

YOLOV3模型训练策略

模型训练策略(YOLOV3)

  1. multi_scale_train = True # 是否使用多尺度训练策略。图像的尺寸默认在[320, 320]到[640, 640]之间变化。
  2. use_label_smooth = True # 是否使用类标签平滑策略。
  3. use_focal_loss = True # 是否在conf loss上使用focal loss。
  4. use_mix_up = True # 是否使用混合型的数据增强策略。
  5. use_warm_up = True # 是否使用预热策略去避免梯度爆炸。
  6. warm_up_epoch = 3 # 预热训练的次数。如果梯度爆炸,设置为一个更大的值。

Some training tricks(YOLOV3)

  1. 使用two-stage训练策略或者one-stage训练策略:
    (1)Two-stage训练策略:
      First stage: Restore darknet53_body part weights from COCO checkpoints, train the yolov3_head with big learning rate like 1e-3 until the loss reaches to a low level.
    Second stage: Restore the weights from the first stage, then train the whole model with small learning rate like 1e-4 or smaller. At this stage remember to restore the optimizer parameters if you use optimizers like adam.
    (2)One-stage训练策略:
      Just restore the whole weight file except the last three convolution layers (Conv_6, Conv_14, Conv_22). In this condition, be careful about the possible nan loss value.

  2. 加入一些其它有用的训练策略:
      Cosine decay of lr (SGDR):学习率余弦衰减
      Multi-scale training:多尺度训练
      Label smoothing:标签平滑
      Mix up data augmentation:混合数据增强
      Focal loss:焦点损失
      这些都是好的训练策略,但是并不意味着它们肯定会提升性能。对于自己的任务应选择合适的策略。

  3. Loss nan? 设置一个更大的预热epoch数量或者更小的学习率,并多次尝试。如果fine-tune整个模型的话,使用adam优化器有时会造成nan。可以尝试选择momentum优化器。

0%