# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLOv8 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect
# Parameters
######Jiayuan
tnc: 3 # number of classes
#######
scales: # model compound scaling constants, i.e. 'model=yolov8n.yaml' will call yolov8.yaml with scale 'n'
# [depth, width, max_channels]
n: [0.33, 0.25, 1024] # YOLOv10s를 가져옴 크기 자체는 동일함.
s: [0.33, 0.50, 1024] # YOLOv8s summary: 225 layers, 11166560 parameters, 11166544 gradients, 28.8 GFLOPs
m: [0.67, 0.75, 768] # YOLOv8m summary: 295 layers, 25902640 parameters, 25902624 gradients, 79.3 GFLOPs
l: [1.00, 1.00, 512] # YOLOv8l summary: 365 layers, 43691520 parameters, 43691504 gradients, 165.7 GFLOPs
x: [1.00, 1.25, 512] # YOLOv8x summary: 365 layers, 68229648 parameters, 68229632 gradients, 258.5 GFLOPs
scale: n
# Conv args(ch_in, ch_out, kernel, stride, padding, groups, dilation, activation)
# C2f args(self, c1, c2, n=1, shortcut=False, g=1, e=0.5): # ch_in, ch_out, number, shortcut, groups, expansion)
# SPPF args(self, c1, c2, k=5): # equivalent to SPP(k=(5, 9, 13))
#
# YOLOv8.0n backbone
backbone:
# [from, repeats, module, args]
# conv의 args에서 ch_in은 자동으로 이전 레이어에서 가져온다. 처음 리스트 값은 ch_out이다.
# 0번 레이어의 경우 Cov작업을 진행 ch_in은 이미지 채널 ch_out은 64, kernel_size는 3, stride는 2이다.
# Cov의 padding은 기본값으로 None값이 들어가 있다.
- [-1, 1, Conv, [64, 3, 2]] # 0-P1/2
- [-1, 1, Conv, [128, 3, 2]] # 1-P2/4
- [-1, 3, C2f, [128, True]]
- [-1, 1, Conv, [256, 3, 2]] # 3-P3/8
- [-1, 6, C2f, [256, True]]
- [-1, 1, Conv, [512, 3, 2]] # 5-P4/16
- [-1, 6, C2f, [512, True]]
- [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32
- [-1, 3, C2f, [1024, True]]
- [-1, 1, SPPF, [1024, 5]] # 9
- [-1, 1, PSA, [1024]] # 10
# YOLOv8.0n head
head:
# detect neck
- [-1, 1, nn.Upsample, [None, 2, 'nearest']] #11
- [[-1, 6], 1, Concat, [1]] # cat backbone P4 12
- [-1, 3, C2f, [512]] # 13
- [-1, 1, nn.Upsample, [None, 2, 'nearest']] #14
- [[-1, 4], 1, Concat, [1]] # cat backbone P3 15
- [-1, 3, C2f, [256]] # 16 (P3/8-small)
- [-1, 1, Conv, [256, 3, 2]] #17
- [[-1, 13], 1, Concat, [1]] # cat head P4 18
- [-1, 3, C2f, [512]] # 19 (P4/16-medium)
- [-1, 1, Conv, [512, 3, 2]] #20
- [[-1, 9], 1, Concat, [1]] # cat head P5 21
- [-1, 3, C2f, [1024]] # 22 (P5/32-large)
# lane neck
- [9, 1, nn.Upsample, [None, 2, 'nearest']] #23
- [[-1, 6], 1, Concat_dropout, [1]] # cat backbone P4 24
- [-1, 3, C2f, [512]] # 25
- [-1, 1, nn.Upsample, [None, 2, 'nearest']] #26
- [[-1, 4], 1, Concat_dropout, [1]] # cat backbone P3 27
- [-1, 3, C2f, [256]] # 28 (P3/8-small)
- [-1, 1, nn.Upsample, [None, 2, 'nearest']] # for lane segmentation #29
- [[-1, 2], 1, Concat_dropout, [1]] # cat backbone P2 30
- [-1, 3, C2f, [128]] # 31 (P2)
- [-1, 1, nn.Upsample, [None, 2, 'nearest']] # 32
- [[-1, 0], 1, Concat_dropout, [1]] # cat backbone P1 33
- [-1, 3, C2f, [64]] # 34 (P1)
# - [-1, 1, nn.Upsample, [None, 2, 'nearest']] #28
# - [-1, 3, C2f, [32]] # 29 (original)
# drivable neck
- [9, 1, nn.Upsample, [None, 2, 'nearest']] #35
- [[-1, 6], 1, Concat_dropout, [1]] # cat backbone P4 36
- [-1, 3, C2f, [512]] # 37
- [-1, 1, nn.Upsample, [None, 2, 'nearest']] #38
- [[-1, 4], 1, Concat_dropout, [1]] # cat backbone P3 #39
- [-1, 3, C2f, [256]] # 40 (P3/8-small)
- [-1, 1, nn.Upsample, [None, 2, 'nearest']] # 30 for drivable segmentation 41
- [[-1, 2], 1, Concat_dropout, [1]] # 42
- [-1, 3, C2f, [128]] # 43 (P2)
- [-1, 1, nn.Upsample, [None, 2, 'nearest']] # 44
- [[-1, 0], 1, Concat_dropout, [1]] #45
- [-1, 3, C2f, [64]] # 46 (P1)
# - [-1, 1, nn.Upsample, [None, 2, 'nearest']] #34
# - [-1, 3, C2f, [32]] # 35 (original)
#
# Neck end
# tasks
# Detect Head의 구조 변경이 필요함.
- [[16, 19, 22], 1, Detect, [1]] # 36 Detect(P3, P4, P5)
# ㄴv10Detect의 args에서 1이라 들어갈게 class말고는 없음 Channel은 계산해서 받아가고.
- [[46], 1, Segment, [1, 32, 256]] # 37 drivable-Segment [1,32,256] was not working, you should change the head.py
- [[34], 1, Segment, [1, 32, 256]] # 38 lane-Segment [1,32,256] was not working, you should change the head.py