[Train] ;True使用cuda训练 cuda = True ; 用于固定随机种子 ; 使得每次独立训练都可以获得一样的结果 seed = 12 ;distributed 用于指定是否使用单机多卡分布式运行 ; 终端指令仅支持Ubuntu。CUDA_VISIBLE_DEVICES用于在Ubuntu下指定显卡。 ; Windows系统下默认使用DP模式调用所有显卡,不支持DDP。 ;DP模式: ; 设置 distributed = False ; 在终端中输入 CUDA_VISIBLE_DEVICES=0,1 python train.py ;DDP模式: ; 设置 distributed = True ; 在终端中输入 CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 train.py distributed = False ; sync_bn 是否使用sync_bn,DDP模式多卡可用 sync_bn = False fp16 = False classes_path = model_data/voc_classes.txt anchors_path = model_data/yolo_anchors.txt anchors_mask = [[6, 7, 8], [3, 4, 5], [0, 1, 2]] model_path = input_shape = [640, 640] backbone = cspdarknet pretrained = False phi = x ; mosaic 马赛克数据增强。 ; mosaic_prob 每个step有多少概率使用mosaic数据增强,默认50%。 ; mixup 是否使用mixup数据增强,仅在mosaic=True时有效。 ; 只会对mosaic增强后的图片进行mixup的处理。 ; mixup_prob 有多少概率在mosaic后使用mixup数据增强,默认50%。 ; 总的mixup概率为mosaic_prob * mixup_prob。 ; special_aug_ratio 参考YoloX,由于Mosaic生成的训练图片,远远脱离自然图片的真实分布。 ; 当mosaic=True时,本代码会在special_aug_ratio范围内开启mosaic。 ; 默认为前70%个epoch,100个世代会开启70个世代。 mosaic = False mosaic_prob = 0.5 mixup = True mixup_prob = 0.5 special_aug_ratio = 0.7 ; label_smoothing 标签平滑。一般0.01以下。如0.01、0.005。 label_smoothing = 0.01 [dataset] classes_path = model_data/voc_classes.txt