YOLOV5:训练自己数据集
YOLOV5: Mosaic 数据增强
YOLOV5:网络模块理解
这里对 YOLOV5 代码中解析模型部分代码进行理解。
文章目录
前言
【个人学习笔记记录,如有错误,欢迎指正】
YOLO-V5 代码仓库地址:https://github.com/ultralytics/yolov5
一、ymal 文件理解
1.模型存在地址
YOLOV5 模型配置文件存放在 modules 文件夹下:这里使用的是 yolov5s.yaml 。
2. yaml 内容理解
yolov5s.yaml 内容理解,这里是官方给出的文件内容。
1.parameters
nc: 2 # number of classes
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.50 # layer channel multiple
【nc】: 类别个数
【depth_multiple】:模型深度超参数(卷积模块的个数)
【width_multiple】:模型宽度超参数(anchors 个数)
2.anchors
anchors:
- [10,13, 16,30, 33,23] # P3/8
- [30,61, 62,45, 59,119] # P4/16
- [116,90, 156,198, 373,326] # P5/32
三个不同尺寸的特征图上,默认 anchors 的高宽值。
3.backbone、head
backbone:
# [from, number, module, args]
[[-1, 1, Focus, [64, 3]], # 0-P1/2
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
[-1, 3, BottleneckCSP, [128]],
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
[-1, 9, BottleneckCSP, [256]],
[-1, 1, Conv, [512, 3, 2]]