源码: YOLOv5源码.
链接: 【YOLOV5-6.1 源码注释】整体项目文件导航.
注释版全部项目文件已上传至GitHub: yolov5-6.1-annotations.
# YOLOv5 by Ultralytics, GPL-3.0 license
# Hyperparameters for low-augmentation COCO training from scratch
# python train.py --batch 64 --cfg yolov5n6.yaml --weights '' --data coco.yaml --img 640 --epochs 300 --linear
# See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
lrf: 0.01 # final OneCycleLR learning rate (lr0 * lrf)
momentum: 0.937 # SGD momentum/Adam beta1
weight_decay: 0.0005 # optimizer weight decay 5e-4
warmup_epochs: 3.0 # warmup epochs (fractions ok)
warmup_momentum: 0.8 # warmup initial momentum
warmup_bias_lr: 0.1 # warmup initial bias lr
box: 0.05 # box loss gain
cls: 0.5 # cls loss gain
cls_pw: 1.0 # cls BCELoss positive_weight
obj: 1.0 # obj loss gain (scale with pixels)
obj_pw: 1.0 # obj BCELoss positive_weight
iou_t: 0.20 # IoU training threshold
anchor_t: 4.0 # anchor-multiple threshold
# anchors: 3 # anchors per output layer (0 to ignore)
fl_gamma: 0.0 # focal loss gamma (efficientDet default gamma=1.5)
hsv_h: 0.015 # image HSV-Hue augmentation (fraction)
hsv_s: 0.7 # image HSV-Saturation augmentation (fraction)
hsv_v: 0.4 # image HSV-Value augmentation (fraction)
degrees: 0.0 # image rotation (+/- deg)
translate: 0.1 # image translation (+/- fraction)
scale: 0.5 # image scale (+/- gain)
shear: 0.0 # image shear (+/- deg)
perspective: 0.0 # image perspective (+/- fraction), range 0-0.001
flipud: 0.0 # image flip up-down (probability)
fliplr: 0.5 # image flip left-right (probability)
mosaic: 1.0 # image mosaic (probability)
mixup: 0.0 # image mixup (probability)
copy_paste: 0.0 # segment copy-paste (probability)
# ================================== 训练相关参数 ================================== #
# 优化器相关
lr0: 0.01 # 初始学习率(SGD=1E-2, Adam=1E-3)
lrf: 0.01 # 最终学习率, 以one_cycle形式或者线性从lr0衰减至lr0 * lrf
momentum: 0.937 # SGD momentum/Adam beta1
weight_decay: 0.0005 # optimizer 权重衰减系数 5e-4
# Warmup 相关
warmup_epochs: 3.0 # 前3个epoch进行warmup
warmup_momentum: 0.8 # warmup 初始化动量
warmup_bias_lr: 0.1 # warmup 初始bias学习率
# ================================== 损失函数相关参数 ================================== #
box: 0.05 # box iou 损失系数
cls: 0.5 # cls 损失系数
cls_pw: 1.0 # cls BCELoss 正样本权重
obj: 1.0 # obj 损失系数 (scale with pixels)
obj_pw: 1.0 # obj BCELoss 正样本权重
fl_gamma: 0.0 # focal loss gamma (efficientDet default gamma=1.5)
# ================================== 其他参数 ================================== #
iou_t: 0.20 # IoU training threshold # 应该是很久以前使用的一个参数,因为那个时候筛选正负样本是靠iou来筛选的,这个iou_t应该就是筛选正负样本用的iou阈值,现在都用宽高比来筛选了,所以这个参数现在也没什么用了
anchor_t: 4.0 # anchor-multiple threshold # anchor的长宽比阈值(长:宽 = 4:1) 用于k-means中计算 bpr和aat
# anchors: 3 # anchors per output layer (0 to ignore) # 每个输出层的anchors数量 (0 to ignore)
# ================================== 数据增强 ================================== #
# 色彩转换
hsv_h: 0.015 # hsv 增强系数 色调
hsv_s: 0.7 # hsv 增强系数 饱和度
hsv_v: 0.4 # hsv 增强系数 亮度
# 旋转、平移、扭曲等
degrees: 0.0 # random_perspective 增强系数 旋转角度 (+/- deg)
translate: 0.1 # random_perspective 增强系数 平移 (+/- fraction)
scale: 0.5 # random_perspective 增强系数 图像缩放 (+/- gain)
shear: 0.0 # random_perspective 增强系数 图像剪切 (+/- deg)
perspective: 0.0 # image perspective 增强系数 透明度 (+/- fraction), range 0-0.001
# 翻转
flipud: 0.0 # 上下翻转数据增强 (probability)
fliplr: 0.5 # 左右翻转数据增强 (probability)
# mosaic、mixup、copy_paste
mosaic: 1.0 # mosaic 数据增强 (probability)
mixup: 0.0 # mixup 数据增强 (probability)
copy_paste: 0.0 # segment copy-paste 数据增强 (probability)
CSDN: https://blog.csdn.net/qq_38253797/article/details/119759746
CSDN: https://blog.csdn.net/irving512/article/details/116238499