glenn-jocher
commited on
Commit
•
fa2344c
1
Parent(s):
76d90d8
Update `models/hub/*.yaml` files for v6.0n release (#5540)
Browse files* Update model yamls for v6.0
* Add python models/yolo.py --test
* Ghost fix
- models/hub/yolov5-bifpn.yaml +7 -7
- models/hub/yolov5-fpn.yaml +11 -11
- models/hub/yolov5-p2.yaml +7 -7
- models/hub/yolov5-p6.yaml +8 -8
- models/hub/yolov5-p7.yaml +6 -6
- models/hub/yolov5-panet.yaml +12 -12
- models/hub/yolov5s-ghost.yaml +6 -6
- models/hub/yolov5s-transformer.yaml +6 -6
- models/yolo.py +9 -0
models/hub/yolov5-bifpn.yaml
CHANGED
@@ -9,22 +9,22 @@ anchors:
|
|
9 |
- [30,61, 62,45, 59,119] # P4/16
|
10 |
- [116,90, 156,198, 373,326] # P5/32
|
11 |
|
12 |
-
# YOLOv5 backbone
|
13 |
backbone:
|
14 |
# [from, number, module, args]
|
15 |
-
[[-1, 1,
|
16 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
17 |
[-1, 3, C3, [128]],
|
18 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
19 |
-
[-1,
|
20 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
21 |
[-1, 9, C3, [512]],
|
22 |
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
23 |
-
[-1,
|
24 |
-
[-1,
|
25 |
]
|
26 |
|
27 |
-
# YOLOv5 BiFPN head
|
28 |
head:
|
29 |
[[-1, 1, Conv, [512, 1, 1]],
|
30 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
@@ -37,7 +37,7 @@ head:
|
|
37 |
[-1, 3, C3, [256, False]], # 17 (P3/8-small)
|
38 |
|
39 |
[-1, 1, Conv, [256, 3, 2]],
|
40 |
-
[[-1, 14, 6], 1, Concat, [1]], # cat P4
|
41 |
[-1, 3, C3, [512, False]], # 20 (P4/16-medium)
|
42 |
|
43 |
[-1, 1, Conv, [512, 3, 2]],
|
|
|
9 |
- [30,61, 62,45, 59,119] # P4/16
|
10 |
- [116,90, 156,198, 373,326] # P5/32
|
11 |
|
12 |
+
# YOLOv5 v6.0 backbone
|
13 |
backbone:
|
14 |
# [from, number, module, args]
|
15 |
+
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
16 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
17 |
[-1, 3, C3, [128]],
|
18 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
19 |
+
[-1, 6, C3, [256]],
|
20 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
21 |
[-1, 9, C3, [512]],
|
22 |
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
23 |
+
[-1, 3, C3, [1024]],
|
24 |
+
[-1, 1, SPPF, [1024, 5]], # 9
|
25 |
]
|
26 |
|
27 |
+
# YOLOv5 v6.0 BiFPN head
|
28 |
head:
|
29 |
[[-1, 1, Conv, [512, 1, 1]],
|
30 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
|
|
37 |
[-1, 3, C3, [256, False]], # 17 (P3/8-small)
|
38 |
|
39 |
[-1, 1, Conv, [256, 3, 2]],
|
40 |
+
[[-1, 14, 6], 1, Concat, [1]], # cat P4 <--- BiFPN change
|
41 |
[-1, 3, C3, [512, False]], # 20 (P4/16-medium)
|
42 |
|
43 |
[-1, 1, Conv, [512, 3, 2]],
|
models/hub/yolov5-fpn.yaml
CHANGED
@@ -9,34 +9,34 @@ anchors:
|
|
9 |
- [30,61, 62,45, 59,119] # P4/16
|
10 |
- [116,90, 156,198, 373,326] # P5/32
|
11 |
|
12 |
-
# YOLOv5 backbone
|
13 |
backbone:
|
14 |
# [from, number, module, args]
|
15 |
-
[[-1, 1,
|
16 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
17 |
-
[-1, 3,
|
18 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
19 |
-
[-1,
|
20 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
21 |
-
[-1, 9,
|
22 |
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
23 |
-
[-1,
|
24 |
-
[-1,
|
25 |
]
|
26 |
|
27 |
-
# YOLOv5 FPN head
|
28 |
head:
|
29 |
-
[[-1, 3,
|
30 |
|
31 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
32 |
[[-1, 6], 1, Concat, [1]], # cat backbone P4
|
33 |
[-1, 1, Conv, [512, 1, 1]],
|
34 |
-
[-1, 3,
|
35 |
|
36 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
37 |
[[-1, 4], 1, Concat, [1]], # cat backbone P3
|
38 |
[-1, 1, Conv, [256, 1, 1]],
|
39 |
-
[-1, 3,
|
40 |
|
41 |
[[18, 14, 10], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
|
42 |
]
|
|
|
9 |
- [30,61, 62,45, 59,119] # P4/16
|
10 |
- [116,90, 156,198, 373,326] # P5/32
|
11 |
|
12 |
+
# YOLOv5 v6.0 backbone
|
13 |
backbone:
|
14 |
# [from, number, module, args]
|
15 |
+
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
16 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
17 |
+
[-1, 3, C3, [128]],
|
18 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
19 |
+
[-1, 6, C3, [256]],
|
20 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
21 |
+
[-1, 9, C3, [512]],
|
22 |
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
23 |
+
[-1, 3, C3, [1024]],
|
24 |
+
[-1, 1, SPPF, [1024, 5]], # 9
|
25 |
]
|
26 |
|
27 |
+
# YOLOv5 v6.0 FPN head
|
28 |
head:
|
29 |
+
[[-1, 3, C3, [1024, False]], # 10 (P5/32-large)
|
30 |
|
31 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
32 |
[[-1, 6], 1, Concat, [1]], # cat backbone P4
|
33 |
[-1, 1, Conv, [512, 1, 1]],
|
34 |
+
[-1, 3, C3, [512, False]], # 14 (P4/16-medium)
|
35 |
|
36 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
37 |
[[-1, 4], 1, Concat, [1]], # cat backbone P3
|
38 |
[-1, 1, Conv, [256, 1, 1]],
|
39 |
+
[-1, 3, C3, [256, False]], # 18 (P3/8-small)
|
40 |
|
41 |
[[18, 14, 10], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
|
42 |
]
|
models/hub/yolov5-p2.yaml
CHANGED
@@ -4,24 +4,24 @@
|
|
4 |
nc: 80 # number of classes
|
5 |
depth_multiple: 1.0 # model depth multiple
|
6 |
width_multiple: 1.0 # layer channel multiple
|
7 |
-
anchors: 3
|
8 |
|
9 |
-
# YOLOv5 backbone
|
10 |
backbone:
|
11 |
# [from, number, module, args]
|
12 |
-
[[-1, 1,
|
13 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
14 |
[-1, 3, C3, [128]],
|
15 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
16 |
-
[-1,
|
17 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
18 |
[-1, 9, C3, [512]],
|
19 |
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
20 |
-
[-1,
|
21 |
-
[-1,
|
22 |
]
|
23 |
|
24 |
-
# YOLOv5 head
|
25 |
head:
|
26 |
[[-1, 1, Conv, [512, 1, 1]],
|
27 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
|
|
4 |
nc: 80 # number of classes
|
5 |
depth_multiple: 1.0 # model depth multiple
|
6 |
width_multiple: 1.0 # layer channel multiple
|
7 |
+
anchors: 3 # auto-anchor evolves 3 anchors per P output layer
|
8 |
|
9 |
+
# YOLOv5 v6.0 backbone
|
10 |
backbone:
|
11 |
# [from, number, module, args]
|
12 |
+
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
13 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
14 |
[-1, 3, C3, [128]],
|
15 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
16 |
+
[-1, 6, C3, [256]],
|
17 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
18 |
[-1, 9, C3, [512]],
|
19 |
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
20 |
+
[-1, 3, C3, [1024]],
|
21 |
+
[-1, 1, SPPF, [1024, 5]], # 9
|
22 |
]
|
23 |
|
24 |
+
# YOLOv5 v6.0 head
|
25 |
head:
|
26 |
[[-1, 1, Conv, [512, 1, 1]],
|
27 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
models/hub/yolov5-p6.yaml
CHANGED
@@ -4,26 +4,26 @@
|
|
4 |
nc: 80 # number of classes
|
5 |
depth_multiple: 1.0 # model depth multiple
|
6 |
width_multiple: 1.0 # layer channel multiple
|
7 |
-
anchors: 3
|
8 |
|
9 |
-
# YOLOv5 backbone
|
10 |
backbone:
|
11 |
# [from, number, module, args]
|
12 |
-
[[-1, 1,
|
13 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
14 |
[-1, 3, C3, [128]],
|
15 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
16 |
-
[-1,
|
17 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
18 |
[-1, 9, C3, [512]],
|
19 |
[-1, 1, Conv, [768, 3, 2]], # 7-P5/32
|
20 |
[-1, 3, C3, [768]],
|
21 |
[-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
|
22 |
-
[-1,
|
23 |
-
[-1,
|
24 |
]
|
25 |
|
26 |
-
# YOLOv5 head
|
27 |
head:
|
28 |
[[-1, 1, Conv, [768, 1, 1]],
|
29 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
@@ -50,7 +50,7 @@ head:
|
|
50 |
|
51 |
[-1, 1, Conv, [768, 3, 2]],
|
52 |
[[-1, 12], 1, Concat, [1]], # cat head P6
|
53 |
-
[-1, 3, C3, [1024, False]], # 32 (
|
54 |
|
55 |
[[23, 26, 29, 32], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5, P6)
|
56 |
]
|
|
|
4 |
nc: 80 # number of classes
|
5 |
depth_multiple: 1.0 # model depth multiple
|
6 |
width_multiple: 1.0 # layer channel multiple
|
7 |
+
anchors: 3 # auto-anchor 3 anchors per P output layer
|
8 |
|
9 |
+
# YOLOv5 v6.0 backbone
|
10 |
backbone:
|
11 |
# [from, number, module, args]
|
12 |
+
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
13 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
14 |
[-1, 3, C3, [128]],
|
15 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
16 |
+
[-1, 6, C3, [256]],
|
17 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
18 |
[-1, 9, C3, [512]],
|
19 |
[-1, 1, Conv, [768, 3, 2]], # 7-P5/32
|
20 |
[-1, 3, C3, [768]],
|
21 |
[-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
|
22 |
+
[-1, 3, C3, [1024]],
|
23 |
+
[-1, 1, SPPF, [1024, 5]], # 11
|
24 |
]
|
25 |
|
26 |
+
# YOLOv5 v6.0 head
|
27 |
head:
|
28 |
[[-1, 1, Conv, [768, 1, 1]],
|
29 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
|
|
50 |
|
51 |
[-1, 1, Conv, [768, 3, 2]],
|
52 |
[[-1, 12], 1, Concat, [1]], # cat head P6
|
53 |
+
[-1, 3, C3, [1024, False]], # 32 (P6/64-xlarge)
|
54 |
|
55 |
[[23, 26, 29, 32], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5, P6)
|
56 |
]
|
models/hub/yolov5-p7.yaml
CHANGED
@@ -4,16 +4,16 @@
|
|
4 |
nc: 80 # number of classes
|
5 |
depth_multiple: 1.0 # model depth multiple
|
6 |
width_multiple: 1.0 # layer channel multiple
|
7 |
-
anchors: 3
|
8 |
|
9 |
-
# YOLOv5 backbone
|
10 |
backbone:
|
11 |
# [from, number, module, args]
|
12 |
-
[[-1, 1,
|
13 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
14 |
[-1, 3, C3, [128]],
|
15 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
16 |
-
[-1,
|
17 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
18 |
[-1, 9, C3, [512]],
|
19 |
[-1, 1, Conv, [768, 3, 2]], # 7-P5/32
|
@@ -21,8 +21,8 @@ backbone:
|
|
21 |
[-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
|
22 |
[-1, 3, C3, [1024]],
|
23 |
[-1, 1, Conv, [1280, 3, 2]], # 11-P7/128
|
24 |
-
[-1,
|
25 |
-
[-1,
|
26 |
]
|
27 |
|
28 |
# YOLOv5 head
|
|
|
4 |
nc: 80 # number of classes
|
5 |
depth_multiple: 1.0 # model depth multiple
|
6 |
width_multiple: 1.0 # layer channel multiple
|
7 |
+
anchors: 3 # auto-anchor 3 anchors per P output layer
|
8 |
|
9 |
+
# YOLOv5 v6.0 backbone
|
10 |
backbone:
|
11 |
# [from, number, module, args]
|
12 |
+
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
13 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
14 |
[-1, 3, C3, [128]],
|
15 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
16 |
+
[-1, 6, C3, [256]],
|
17 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
18 |
[-1, 9, C3, [512]],
|
19 |
[-1, 1, Conv, [768, 3, 2]], # 7-P5/32
|
|
|
21 |
[-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
|
22 |
[-1, 3, C3, [1024]],
|
23 |
[-1, 1, Conv, [1280, 3, 2]], # 11-P7/128
|
24 |
+
[-1, 3, C3, [1280]],
|
25 |
+
[-1, 1, SPPF, [1280, 5]], # 13
|
26 |
]
|
27 |
|
28 |
# YOLOv5 head
|
models/hub/yolov5-panet.yaml
CHANGED
@@ -9,40 +9,40 @@ anchors:
|
|
9 |
- [30,61, 62,45, 59,119] # P4/16
|
10 |
- [116,90, 156,198, 373,326] # P5/32
|
11 |
|
12 |
-
# YOLOv5 backbone
|
13 |
backbone:
|
14 |
# [from, number, module, args]
|
15 |
-
[[-1, 1,
|
16 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
17 |
-
[-1, 3,
|
18 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
19 |
-
[-1,
|
20 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
21 |
-
[-1, 9,
|
22 |
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
23 |
-
[-1,
|
24 |
-
[-1,
|
25 |
]
|
26 |
|
27 |
-
# YOLOv5 PANet head
|
28 |
head:
|
29 |
[[-1, 1, Conv, [512, 1, 1]],
|
30 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
31 |
[[-1, 6], 1, Concat, [1]], # cat backbone P4
|
32 |
-
[-1, 3,
|
33 |
|
34 |
[-1, 1, Conv, [256, 1, 1]],
|
35 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
36 |
[[-1, 4], 1, Concat, [1]], # cat backbone P3
|
37 |
-
[-1, 3,
|
38 |
|
39 |
[-1, 1, Conv, [256, 3, 2]],
|
40 |
[[-1, 14], 1, Concat, [1]], # cat head P4
|
41 |
-
[-1, 3,
|
42 |
|
43 |
[-1, 1, Conv, [512, 3, 2]],
|
44 |
[[-1, 10], 1, Concat, [1]], # cat head P5
|
45 |
-
[-1, 3,
|
46 |
|
47 |
[[17, 20, 23], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
|
48 |
]
|
|
|
9 |
- [30,61, 62,45, 59,119] # P4/16
|
10 |
- [116,90, 156,198, 373,326] # P5/32
|
11 |
|
12 |
+
# YOLOv5 v6.0 backbone
|
13 |
backbone:
|
14 |
# [from, number, module, args]
|
15 |
+
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
16 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
17 |
+
[-1, 3, C3, [128]],
|
18 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
19 |
+
[-1, 6, C3, [256]],
|
20 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
21 |
+
[-1, 9, C3, [512]],
|
22 |
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
23 |
+
[-1, 3, C3, [1024]],
|
24 |
+
[-1, 1, SPPF, [1024, 5]], # 9
|
25 |
]
|
26 |
|
27 |
+
# YOLOv5 v6.0 PANet head
|
28 |
head:
|
29 |
[[-1, 1, Conv, [512, 1, 1]],
|
30 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
31 |
[[-1, 6], 1, Concat, [1]], # cat backbone P4
|
32 |
+
[-1, 3, C3, [512, False]], # 13
|
33 |
|
34 |
[-1, 1, Conv, [256, 1, 1]],
|
35 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
36 |
[[-1, 4], 1, Concat, [1]], # cat backbone P3
|
37 |
+
[-1, 3, C3, [256, False]], # 17 (P3/8-small)
|
38 |
|
39 |
[-1, 1, Conv, [256, 3, 2]],
|
40 |
[[-1, 14], 1, Concat, [1]], # cat head P4
|
41 |
+
[-1, 3, C3, [512, False]], # 20 (P4/16-medium)
|
42 |
|
43 |
[-1, 1, Conv, [512, 3, 2]],
|
44 |
[[-1, 10], 1, Concat, [1]], # cat head P5
|
45 |
+
[-1, 3, C3, [1024, False]], # 23 (P5/32-large)
|
46 |
|
47 |
[[17, 20, 23], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
|
48 |
]
|
models/hub/yolov5s-ghost.yaml
CHANGED
@@ -9,22 +9,22 @@ anchors:
|
|
9 |
- [30,61, 62,45, 59,119] # P4/16
|
10 |
- [116,90, 156,198, 373,326] # P5/32
|
11 |
|
12 |
-
# YOLOv5 backbone
|
13 |
backbone:
|
14 |
# [from, number, module, args]
|
15 |
-
[[-1, 1,
|
16 |
[-1, 1, GhostConv, [128, 3, 2]], # 1-P2/4
|
17 |
[-1, 3, C3Ghost, [128]],
|
18 |
[-1, 1, GhostConv, [256, 3, 2]], # 3-P3/8
|
19 |
-
[-1,
|
20 |
[-1, 1, GhostConv, [512, 3, 2]], # 5-P4/16
|
21 |
[-1, 9, C3Ghost, [512]],
|
22 |
[-1, 1, GhostConv, [1024, 3, 2]], # 7-P5/32
|
23 |
-
[-1,
|
24 |
-
[-1,
|
25 |
]
|
26 |
|
27 |
-
# YOLOv5 head
|
28 |
head:
|
29 |
[[-1, 1, GhostConv, [512, 1, 1]],
|
30 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
|
|
9 |
- [30,61, 62,45, 59,119] # P4/16
|
10 |
- [116,90, 156,198, 373,326] # P5/32
|
11 |
|
12 |
+
# YOLOv5 v6.0 backbone
|
13 |
backbone:
|
14 |
# [from, number, module, args]
|
15 |
+
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
16 |
[-1, 1, GhostConv, [128, 3, 2]], # 1-P2/4
|
17 |
[-1, 3, C3Ghost, [128]],
|
18 |
[-1, 1, GhostConv, [256, 3, 2]], # 3-P3/8
|
19 |
+
[-1, 6, C3Ghost, [256]],
|
20 |
[-1, 1, GhostConv, [512, 3, 2]], # 5-P4/16
|
21 |
[-1, 9, C3Ghost, [512]],
|
22 |
[-1, 1, GhostConv, [1024, 3, 2]], # 7-P5/32
|
23 |
+
[-1, 3, C3Ghost, [1024]],
|
24 |
+
[-1, 1, SPPF, [1024, 5]], # 9
|
25 |
]
|
26 |
|
27 |
+
# YOLOv5 v6.0 head
|
28 |
head:
|
29 |
[[-1, 1, GhostConv, [512, 1, 1]],
|
30 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
models/hub/yolov5s-transformer.yaml
CHANGED
@@ -9,22 +9,22 @@ anchors:
|
|
9 |
- [30,61, 62,45, 59,119] # P4/16
|
10 |
- [116,90, 156,198, 373,326] # P5/32
|
11 |
|
12 |
-
# YOLOv5 backbone
|
13 |
backbone:
|
14 |
# [from, number, module, args]
|
15 |
-
[[-1, 1,
|
16 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
17 |
[-1, 3, C3, [128]],
|
18 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
19 |
-
[-1,
|
20 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
21 |
[-1, 9, C3, [512]],
|
22 |
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
23 |
-
[-1,
|
24 |
-
[-1,
|
25 |
]
|
26 |
|
27 |
-
# YOLOv5 head
|
28 |
head:
|
29 |
[[-1, 1, Conv, [512, 1, 1]],
|
30 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
|
|
9 |
- [30,61, 62,45, 59,119] # P4/16
|
10 |
- [116,90, 156,198, 373,326] # P5/32
|
11 |
|
12 |
+
# YOLOv5 v6.0 backbone
|
13 |
backbone:
|
14 |
# [from, number, module, args]
|
15 |
+
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
16 |
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
17 |
[-1, 3, C3, [128]],
|
18 |
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
19 |
+
[-1, 6, C3, [256]],
|
20 |
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
21 |
[-1, 9, C3, [512]],
|
22 |
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
23 |
+
[-1, 3, C3TR, [1024]], # 9 <--- C3TR() Transformer module
|
24 |
+
[-1, 1, SPPF, [1024, 5]], # 9
|
25 |
]
|
26 |
|
27 |
+
# YOLOv5 v6.0 head
|
28 |
head:
|
29 |
[[-1, 1, Conv, [512, 1, 1]],
|
30 |
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
models/yolo.py
CHANGED
@@ -306,6 +306,7 @@ if __name__ == '__main__':
|
|
306 |
parser.add_argument('--cfg', type=str, default='yolov5s.yaml', help='model.yaml')
|
307 |
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
|
308 |
parser.add_argument('--profile', action='store_true', help='profile model speed')
|
|
|
309 |
opt = parser.parse_args()
|
310 |
opt.cfg = check_yaml(opt.cfg) # check YAML
|
311 |
print_args(FILE.stem, opt)
|
@@ -320,6 +321,14 @@ if __name__ == '__main__':
|
|
320 |
img = torch.rand(8 if torch.cuda.is_available() else 1, 3, 640, 640).to(device)
|
321 |
y = model(img, profile=True)
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
# Tensorboard (not working https://github.com/ultralytics/yolov5/issues/2898)
|
324 |
# from torch.utils.tensorboard import SummaryWriter
|
325 |
# tb_writer = SummaryWriter('.')
|
|
|
306 |
parser.add_argument('--cfg', type=str, default='yolov5s.yaml', help='model.yaml')
|
307 |
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
|
308 |
parser.add_argument('--profile', action='store_true', help='profile model speed')
|
309 |
+
parser.add_argument('--test', action='store_true', help='test all yolo*.yaml')
|
310 |
opt = parser.parse_args()
|
311 |
opt.cfg = check_yaml(opt.cfg) # check YAML
|
312 |
print_args(FILE.stem, opt)
|
|
|
321 |
img = torch.rand(8 if torch.cuda.is_available() else 1, 3, 640, 640).to(device)
|
322 |
y = model(img, profile=True)
|
323 |
|
324 |
+
# Test all models
|
325 |
+
if opt.test:
|
326 |
+
for cfg in Path(ROOT / 'models').rglob('yolo*.yaml'):
|
327 |
+
try:
|
328 |
+
_ = Model(cfg)
|
329 |
+
except Exception as e:
|
330 |
+
print(f'Error in {cfg}: {e}')
|
331 |
+
|
332 |
# Tensorboard (not working https://github.com/ultralytics/yolov5/issues/2898)
|
333 |
# from torch.utils.tensorboard import SummaryWriter
|
334 |
# tb_writer = SummaryWriter('.')
|