glenn-jocher commited on
Commit
956be8e
β€’
1 Parent(s): 938efe5

YOLOv5 release v6.0 (#5141)

Browse files

* Update P5 models

* Update P6 models

* Update with GFLOPs and Params

* Update with GFLOPs and Params

* Update README

* Update

* Update README

* Update

* Update

* Add times

* Update README

* Update results

* Update results

* Update results

* Update hyps

* Update plots

* Update plots

* Update README.md

* Add nano models to hubconf.py

README.md CHANGED
@@ -191,7 +191,7 @@ Get started in seconds with our verified environments. Click each icon below for
191
  </a>
192
  </div>
193
 
194
- |Weights and Biases|Roboflow - ⭐ NEW|
195
  |:-:|:-:|
196
  |Automatically track and visualize all your YOLOv5 training runs in the cloud with [Weights & Biases](https://wandb.ai/site?utm_campaign=repo_yolo_readme)|Label and automatically export your custom datasets directly to YOLOv5 for training with [Roboflow](https://roboflow.com/?ref=ultralytics) |
197
 
@@ -207,53 +207,47 @@ We are super excited about our first-ever Ultralytics YOLOv5 πŸš€ EXPORT Competi
207
 
208
  ## <div align="center">Why YOLOv5</div>
209
 
210
- <p align="center"><img width="800" src="https://user-images.githubusercontent.com/26833433/114313216-f0a5e100-9af5-11eb-8445-c682b60da2e3.png"></p>
211
  <details>
212
  <summary>YOLOv5-P5 640 Figure (click to expand)</summary>
213
 
214
- <p align="center"><img width="800" src="https://user-images.githubusercontent.com/26833433/114313219-f1d70e00-9af5-11eb-9973-52b1f98d321a.png"></p>
215
  </details>
216
  <details>
217
  <summary>Figure Notes (click to expand)</summary>
218
 
219
- * GPU Speed measures end-to-end time per image averaged over 5000 COCO val2017 images using a V100 GPU with batch size
220
- 32, and includes image preprocessing, PyTorch FP16 inference, postprocessing and NMS.
221
- * EfficientDet data from [google/automl](https://github.com/google/automl) at batch size 8.
222
- * **Reproduce** by
223
- `python val.py --task study --data coco.yaml --iou 0.7 --weights yolov5s6.pt yolov5m6.pt yolov5l6.pt yolov5x6.pt`
224
-
225
  </details>
226
 
227
  ### Pretrained Checkpoints
228
 
229
  [assets]: https://github.com/ultralytics/yolov5/releases
230
-
231
- |Model |size<br><sup>(pixels) |mAP<sup>val<br>0.5:0.95 |mAP<sup>test<br>0.5:0.95 |mAP<sup>val<br>0.5 |Speed<br><sup>V100 (ms) | |params<br><sup>(M) |FLOPs<br><sup>640 (B)
232
- |--- |--- |--- |--- |--- |--- |---|--- |---
233
- |[YOLOv5s][assets] |640 |36.7 |36.7 |55.4 |**2.0** | |7.3 |17.0
234
- |[YOLOv5m][assets] |640 |44.5 |44.5 |63.1 |2.7 | |21.4 |51.3
235
- |[YOLOv5l][assets] |640 |48.2 |48.2 |66.9 |3.8 | |47.0 |115.4
236
- |[YOLOv5x][assets] |640 |**50.4** |**50.4** |**68.8** |6.1 | |87.7 |218.8
237
- | | | | | | | | |
238
- |[YOLOv5s6][assets] |1280 |43.3 |43.3 |61.9 |**4.3** | |12.7 |17.4
239
- |[YOLOv5m6][assets] |1280 |50.5 |50.5 |68.7 |8.4 | |35.9 |52.4
240
- |[YOLOv5l6][assets] |1280 |53.4 |53.4 |71.1 |12.3 | |77.2 |117.7
241
- |[YOLOv5x6][assets] |1280 |**54.4** |**54.4** |**72.0** |22.4 | |141.8 |222.9
242
- | | | | | | | | |
243
- |[YOLOv5x6][assets] TTA |1280 |**55.0** |**55.0** |**72.0** |70.8 | |- |-
 
244
 
245
  <details>
246
  <summary>Table Notes (click to expand)</summary>
247
 
248
  * All checkpoints are trained to 300 epochs with default settings and hyperparameters.
249
- * AP<sup>test</sup> denotes COCO [test-dev2017](http://cocodataset.org/#upload) server results, all other AP results
250
- denote val2017 accuracy.
251
- * **mAP** values are for single-model single-scale unless otherwise noted.<br>**Reproduce** by `python val.py --data coco.yaml --img 640 --conf 0.001 --iou 0.65`
252
- * **Speed** averaged over 5000 COCO val2017 images using a
253
- GCP [n1-standard-16](https://cloud.google.com/compute/docs/machine-types#n1_standard_machine_types) V100 instance, and
254
- includes FP16 inference, postprocessing and NMS.<br>**Reproduce**
255
- by `python val.py --data coco.yaml --img 640 --conf 0.25 --iou 0.45 --half`
256
- * **TTA** [Test Time Augmentation](https://github.com/ultralytics/yolov5/issues/303) includes reflection and scale.<br>**Reproduce** by `python val.py --data coco.yaml --img 1536 --iou 0.7 --augment`
257
 
258
  </details>
259
 
 
191
  </a>
192
  </div>
193
 
194
+ |Weights and Biases|Roboflow ⭐ NEW|
195
  |:-:|:-:|
196
  |Automatically track and visualize all your YOLOv5 training runs in the cloud with [Weights & Biases](https://wandb.ai/site?utm_campaign=repo_yolo_readme)|Label and automatically export your custom datasets directly to YOLOv5 for training with [Roboflow](https://roboflow.com/?ref=ultralytics) |
197
 
 
207
 
208
  ## <div align="center">Why YOLOv5</div>
209
 
210
+ <p align="left"><img width="800" src="https://user-images.githubusercontent.com/26833433/136901921-abcfcd9d-f978-4942-9b97-0e3f202907df.png"></p>
211
  <details>
212
  <summary>YOLOv5-P5 640 Figure (click to expand)</summary>
213
 
214
+ <p align="left"><img width="800" src="https://user-images.githubusercontent.com/26833433/136763877-b174052b-c12f-48d2-8bc4-545e3853398e.png"></p>
215
  </details>
216
  <details>
217
  <summary>Figure Notes (click to expand)</summary>
218
 
219
+ * **COCO AP val** denotes mAP@0.5:0.95 metric measured on the 5000-image [COCO val2017](http://cocodataset.org) dataset over various inference sizes from 256 to 1536.
220
+ * **GPU Speed** measures average inference time per image on [COCO val2017](http://cocodataset.org) dataset using a [AWS p3.2xlarge](https://aws.amazon.com/ec2/instance-types/p3/) V100 instance at batch-size 32.
221
+ * **EfficientDet** data from [google/automl](https://github.com/google/automl) at batch size 8.
222
+ * **Reproduce** by `python val.py --task study --data coco.yaml --iou 0.7 --weights yolov5n6.pt yolov5s6.pt yolov5m6.pt yolov5l6.pt yolov5x6.pt`
 
 
223
  </details>
224
 
225
  ### Pretrained Checkpoints
226
 
227
  [assets]: https://github.com/ultralytics/yolov5/releases
228
+ [TTA]: https://github.com/ultralytics/yolov5/issues/303
229
+
230
+ |Model |size<br><sup>(pixels) |mAP<sup>val<br>0.5:0.95 |mAP<sup>val<br>0.5 |Speed<br><sup>CPU b1<br>(ms) |Speed<br><sup>V100 b1<br>(ms) |Speed<br><sup>V100 b32<br>(ms) |params<br><sup>(M) |FLOPs<br><sup>@640 (B)
231
+ |--- |--- |--- |--- |--- |--- |--- |--- |---
232
+ |[YOLOv5n][assets] |640 |28.4 |46.0 |**45** |**6.3**|**0.6**|**1.9**|**4.5**
233
+ |[YOLOv5s][assets] |640 |37.2 |56.0 |98 |6.4 |0.9 |7.2 |16.5
234
+ |[YOLOv5m][assets] |640 |45.2 |63.9 |224 |8.2 |1.7 |21.2 |49.0
235
+ |[YOLOv5l][assets] |640 |48.8 |67.2 |430 |10.1 |2.7 |46.5 |109.1
236
+ |[YOLOv5x][assets] |640 |50.7 |68.9 |766 |12.1 |4.8 |86.7 |205.7
237
+ | | | | | | | | |
238
+ |[YOLOv5n6][assets] |1280 |34.0 |50.7 |153 |8.1 |2.1 |3.2 |4.6
239
+ |[YOLOv5s6][assets] |1280 |44.5 |63.0 |385 |8.2 |3.6 |16.8 |12.6
240
+ |[YOLOv5m6][assets] |1280 |51.0 |69.0 |887 |11.1 |6.8 |35.7 |50.0
241
+ |[YOLOv5l6][assets] |1280 |53.6 |71.6 |1784 |15.8 |10.5 |76.8 |111.4
242
+ |[YOLOv5x6][assets]<br>+ [TTA][TTA]|1280<br>1536 |54.7<br>**55.4** |**72.4**<br>72.3 |3136<br>- |26.2<br>- |19.4<br>- |140.7<br>- |209.8<br>-
243
 
244
  <details>
245
  <summary>Table Notes (click to expand)</summary>
246
 
247
  * All checkpoints are trained to 300 epochs with default settings and hyperparameters.
248
+ * **mAP<sup>val</sup>** values are for single-model single-scale on [COCO val2017](http://cocodataset.org) dataset.<br>Reproduce by `python val.py --data coco.yaml --img 640 --conf 0.001 --iou 0.65`
249
+ * **Speed** averaged over COCO val images using a [AWS p3.2xlarge](https://aws.amazon.com/ec2/instance-types/p3/) instance. NMS times (~1 ms/img) not included.<br>Reproduce by `python val.py --data coco.yaml --img 640 --conf 0.25 --iou 0.45`
250
+ * **TTA** [Test Time Augmentation](https://github.com/ultralytics/yolov5/issues/303) includes reflection and scale augmentations.<br>Reproduce by `python val.py --data coco.yaml --img 1536 --iou 0.7 --augment`
 
 
 
 
 
251
 
252
  </details>
253
 
data/hyps/{hyp.scratch-p6.yaml β†’ hyp.scratch-high.yaml} RENAMED
@@ -1,5 +1,5 @@
1
  # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
- # Hyperparameters for COCO training from scratch
3
  # python train.py --batch 32 --cfg yolov5m6.yaml --weights '' --data coco.yaml --img 1280 --epochs 300
4
  # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
5
 
@@ -30,5 +30,5 @@ perspective: 0.0 # image perspective (+/- fraction), range 0-0.001
30
  flipud: 0.0 # image flip up-down (probability)
31
  fliplr: 0.5 # image flip left-right (probability)
32
  mosaic: 1.0 # image mosaic (probability)
33
- mixup: 0.0 # image mixup (probability)
34
- copy_paste: 0.0 # segment copy-paste (probability)
 
1
  # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Hyperparameters for high-augmentation COCO training from scratch
3
  # python train.py --batch 32 --cfg yolov5m6.yaml --weights '' --data coco.yaml --img 1280 --epochs 300
4
  # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
5
 
 
30
  flipud: 0.0 # image flip up-down (probability)
31
  fliplr: 0.5 # image flip left-right (probability)
32
  mosaic: 1.0 # image mosaic (probability)
33
+ mixup: 0.1 # image mixup (probability)
34
+ copy_paste: 0.1 # segment copy-paste (probability)
data/hyps/hyp.scratch-low.yaml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Hyperparameters for low-augmentation COCO training from scratch
3
+ # python train.py --batch 64 --cfg yolov5n6.yaml --weights '' --data coco.yaml --img 640 --epochs 300 --linear
4
+ # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
5
+
6
+ lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
7
+ lrf: 0.01 # final OneCycleLR learning rate (lr0 * lrf)
8
+ momentum: 0.937 # SGD momentum/Adam beta1
9
+ weight_decay: 0.0005 # optimizer weight decay 5e-4
10
+ warmup_epochs: 3.0 # warmup epochs (fractions ok)
11
+ warmup_momentum: 0.8 # warmup initial momentum
12
+ warmup_bias_lr: 0.1 # warmup initial bias lr
13
+ box: 0.05 # box loss gain
14
+ cls: 0.5 # cls loss gain
15
+ cls_pw: 1.0 # cls BCELoss positive_weight
16
+ obj: 1.0 # obj loss gain (scale with pixels)
17
+ obj_pw: 1.0 # obj BCELoss positive_weight
18
+ iou_t: 0.20 # IoU training threshold
19
+ anchor_t: 4.0 # anchor-multiple threshold
20
+ # anchors: 3 # anchors per output layer (0 to ignore)
21
+ fl_gamma: 0.0 # focal loss gamma (efficientDet default gamma=1.5)
22
+ hsv_h: 0.015 # image HSV-Hue augmentation (fraction)
23
+ hsv_s: 0.7 # image HSV-Saturation augmentation (fraction)
24
+ hsv_v: 0.4 # image HSV-Value augmentation (fraction)
25
+ degrees: 0.0 # image rotation (+/- deg)
26
+ translate: 0.1 # image translation (+/- fraction)
27
+ scale: 0.5 # image scale (+/- gain)
28
+ shear: 0.0 # image shear (+/- deg)
29
+ perspective: 0.0 # image perspective (+/- fraction), range 0-0.001
30
+ flipud: 0.0 # image flip up-down (probability)
31
+ fliplr: 0.5 # image flip left-right (probability)
32
+ mosaic: 1.0 # image mosaic (probability)
33
+ mixup: 0.0 # image mixup (probability)
34
+ copy_paste: 0.0 # segment copy-paste (probability)
data/hyps/hyp.scratch.yaml CHANGED
@@ -4,7 +4,7 @@
4
  # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
5
 
6
  lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
7
- lrf: 0.2 # final OneCycleLR learning rate (lr0 * lrf)
8
  momentum: 0.937 # SGD momentum/Adam beta1
9
  weight_decay: 0.0005 # optimizer weight decay 5e-4
10
  warmup_epochs: 3.0 # warmup epochs (fractions ok)
 
4
  # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
5
 
6
  lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
7
+ lrf: 0.1 # final OneCycleLR learning rate (lr0 * lrf)
8
  momentum: 0.937 # SGD momentum/Adam beta1
9
  weight_decay: 0.0005 # optimizer weight decay 5e-4
10
  warmup_epochs: 3.0 # warmup epochs (fractions ok)
hubconf.py CHANGED
@@ -70,6 +70,11 @@ def custom(path='path/to/model.pt', autoshape=True, verbose=True, device=None):
70
  return _create(path, autoshape=autoshape, verbose=verbose, device=device)
71
 
72
 
 
 
 
 
 
73
  def yolov5s(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
74
  # YOLOv5-small model https://github.com/ultralytics/yolov5
75
  return _create('yolov5s', pretrained, channels, classes, autoshape, verbose, device)
@@ -90,6 +95,11 @@ def yolov5x(pretrained=True, channels=3, classes=80, autoshape=True, verbose=Tru
90
  return _create('yolov5x', pretrained, channels, classes, autoshape, verbose, device)
91
 
92
 
 
 
 
 
 
93
  def yolov5s6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
94
  # YOLOv5-small-P6 model https://github.com/ultralytics/yolov5
95
  return _create('yolov5s6', pretrained, channels, classes, autoshape, verbose, device)
 
70
  return _create(path, autoshape=autoshape, verbose=verbose, device=device)
71
 
72
 
73
+ def yolov5n(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
74
+ # YOLOv5-nano model https://github.com/ultralytics/yolov5
75
+ return _create('yolov5n', pretrained, channels, classes, autoshape, verbose, device)
76
+
77
+
78
  def yolov5s(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
79
  # YOLOv5-small model https://github.com/ultralytics/yolov5
80
  return _create('yolov5s', pretrained, channels, classes, autoshape, verbose, device)
 
95
  return _create('yolov5x', pretrained, channels, classes, autoshape, verbose, device)
96
 
97
 
98
+ def yolov5n6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
99
+ # YOLOv5-nano-P6 model https://github.com/ultralytics/yolov5
100
+ return _create('yolov5n6', pretrained, channels, classes, autoshape, verbose, device)
101
+
102
+
103
  def yolov5s6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
104
  # YOLOv5-small-P6 model https://github.com/ultralytics/yolov5
105
  return _create('yolov5s6', pretrained, channels, classes, autoshape, verbose, device)
models/hub/yolov5l6.yaml CHANGED
@@ -10,24 +10,24 @@ anchors:
10
  - [140,301, 303,264, 238,542] # P5/32
11
  - [436,615, 739,380, 925,792] # P6/64
12
 
13
- # YOLOv5 backbone
14
  backbone:
15
  # [from, number, module, args]
16
- [[-1, 1, Focus, [64, 3]], # 0-P1/2
17
  [-1, 1, Conv, [128, 3, 2]], # 1-P2/4
18
  [-1, 3, C3, [128]],
19
  [-1, 1, Conv, [256, 3, 2]], # 3-P3/8
20
- [-1, 9, C3, [256]],
21
  [-1, 1, Conv, [512, 3, 2]], # 5-P4/16
22
  [-1, 9, C3, [512]],
23
  [-1, 1, Conv, [768, 3, 2]], # 7-P5/32
24
  [-1, 3, C3, [768]],
25
  [-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
26
- [-1, 1, SPP, [1024, [3, 5, 7]]],
27
- [-1, 3, C3, [1024, False]], # 11
28
  ]
29
 
30
- # YOLOv5 head
31
  head:
32
  [[-1, 1, Conv, [768, 1, 1]],
33
  [-1, 1, nn.Upsample, [None, 2, 'nearest']],
 
10
  - [140,301, 303,264, 238,542] # P5/32
11
  - [436,615, 739,380, 925,792] # P6/64
12
 
13
+ # YOLOv5 v6.0 backbone
14
  backbone:
15
  # [from, number, module, args]
16
+ [[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
17
  [-1, 1, Conv, [128, 3, 2]], # 1-P2/4
18
  [-1, 3, C3, [128]],
19
  [-1, 1, Conv, [256, 3, 2]], # 3-P3/8
20
+ [-1, 6, C3, [256]],
21
  [-1, 1, Conv, [512, 3, 2]], # 5-P4/16
22
  [-1, 9, C3, [512]],
23
  [-1, 1, Conv, [768, 3, 2]], # 7-P5/32
24
  [-1, 3, C3, [768]],
25
  [-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
26
+ [-1, 3, C3, [1024]],
27
+ [-1, 1, SPPF, [1024, 5]], # 11
28
  ]
29
 
30
+ # YOLOv5 v6.0 head
31
  head:
32
  [[-1, 1, Conv, [768, 1, 1]],
33
  [-1, 1, nn.Upsample, [None, 2, 'nearest']],
models/hub/yolov5m6.yaml CHANGED
@@ -10,24 +10,24 @@ anchors:
10
  - [140,301, 303,264, 238,542] # P5/32
11
  - [436,615, 739,380, 925,792] # P6/64
12
 
13
- # YOLOv5 backbone
14
  backbone:
15
  # [from, number, module, args]
16
- [[-1, 1, Focus, [64, 3]], # 0-P1/2
17
  [-1, 1, Conv, [128, 3, 2]], # 1-P2/4
18
  [-1, 3, C3, [128]],
19
  [-1, 1, Conv, [256, 3, 2]], # 3-P3/8
20
- [-1, 9, C3, [256]],
21
  [-1, 1, Conv, [512, 3, 2]], # 5-P4/16
22
  [-1, 9, C3, [512]],
23
  [-1, 1, Conv, [768, 3, 2]], # 7-P5/32
24
  [-1, 3, C3, [768]],
25
  [-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
26
- [-1, 1, SPP, [1024, [3, 5, 7]]],
27
- [-1, 3, C3, [1024, False]], # 11
28
  ]
29
 
30
- # YOLOv5 head
31
  head:
32
  [[-1, 1, Conv, [768, 1, 1]],
33
  [-1, 1, nn.Upsample, [None, 2, 'nearest']],
 
10
  - [140,301, 303,264, 238,542] # P5/32
11
  - [436,615, 739,380, 925,792] # P6/64
12
 
13
+ # YOLOv5 v6.0 backbone
14
  backbone:
15
  # [from, number, module, args]
16
+ [[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
17
  [-1, 1, Conv, [128, 3, 2]], # 1-P2/4
18
  [-1, 3, C3, [128]],
19
  [-1, 1, Conv, [256, 3, 2]], # 3-P3/8
20
+ [-1, 6, C3, [256]],
21
  [-1, 1, Conv, [512, 3, 2]], # 5-P4/16
22
  [-1, 9, C3, [512]],
23
  [-1, 1, Conv, [768, 3, 2]], # 7-P5/32
24
  [-1, 3, C3, [768]],
25
  [-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
26
+ [-1, 3, C3, [1024]],
27
+ [-1, 1, SPPF, [1024, 5]], # 11
28
  ]
29
 
30
+ # YOLOv5 v6.0 head
31
  head:
32
  [[-1, 1, Conv, [768, 1, 1]],
33
  [-1, 1, nn.Upsample, [None, 2, 'nearest']],
models/hub/yolov5n6.yaml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+
3
+ # Parameters
4
+ nc: 80 # number of classes
5
+ depth_multiple: 0.33 # model depth multiple
6
+ width_multiple: 0.25 # layer channel multiple
7
+ anchors:
8
+ - [19,27, 44,40, 38,94] # P3/8
9
+ - [96,68, 86,152, 180,137] # P4/16
10
+ - [140,301, 303,264, 238,542] # P5/32
11
+ - [436,615, 739,380, 925,792] # P6/64
12
+
13
+ # YOLOv5 v6.0 backbone
14
+ backbone:
15
+ # [from, number, module, args]
16
+ [[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
17
+ [-1, 1, Conv, [128, 3, 2]], # 1-P2/4
18
+ [-1, 3, C3, [128]],
19
+ [-1, 1, Conv, [256, 3, 2]], # 3-P3/8
20
+ [-1, 6, C3, [256]],
21
+ [-1, 1, Conv, [512, 3, 2]], # 5-P4/16
22
+ [-1, 9, C3, [512]],
23
+ [-1, 1, Conv, [768, 3, 2]], # 7-P5/32
24
+ [-1, 3, C3, [768]],
25
+ [-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
26
+ [-1, 3, C3, [1024]],
27
+ [-1, 1, SPPF, [1024, 5]], # 11
28
+ ]
29
+
30
+ # YOLOv5 v6.0 head
31
+ head:
32
+ [[-1, 1, Conv, [768, 1, 1]],
33
+ [-1, 1, nn.Upsample, [None, 2, 'nearest']],
34
+ [[-1, 8], 1, Concat, [1]], # cat backbone P5
35
+ [-1, 3, C3, [768, False]], # 15
36
+
37
+ [-1, 1, Conv, [512, 1, 1]],
38
+ [-1, 1, nn.Upsample, [None, 2, 'nearest']],
39
+ [[-1, 6], 1, Concat, [1]], # cat backbone P4
40
+ [-1, 3, C3, [512, False]], # 19
41
+
42
+ [-1, 1, Conv, [256, 1, 1]],
43
+ [-1, 1, nn.Upsample, [None, 2, 'nearest']],
44
+ [[-1, 4], 1, Concat, [1]], # cat backbone P3
45
+ [-1, 3, C3, [256, False]], # 23 (P3/8-small)
46
+
47
+ [-1, 1, Conv, [256, 3, 2]],
48
+ [[-1, 20], 1, Concat, [1]], # cat head P4
49
+ [-1, 3, C3, [512, False]], # 26 (P4/16-medium)
50
+
51
+ [-1, 1, Conv, [512, 3, 2]],
52
+ [[-1, 16], 1, Concat, [1]], # cat head P5
53
+ [-1, 3, C3, [768, False]], # 29 (P5/32-large)
54
+
55
+ [-1, 1, Conv, [768, 3, 2]],
56
+ [[-1, 12], 1, Concat, [1]], # cat head P6
57
+ [-1, 3, C3, [1024, False]], # 32 (P6/64-xlarge)
58
+
59
+ [[23, 26, 29, 32], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5, P6)
60
+ ]
models/hub/yolov5s6.yaml CHANGED
@@ -10,24 +10,24 @@ anchors:
10
  - [140,301, 303,264, 238,542] # P5/32
11
  - [436,615, 739,380, 925,792] # P6/64
12
 
13
- # YOLOv5 backbone
14
  backbone:
15
  # [from, number, module, args]
16
- [[-1, 1, Focus, [64, 3]], # 0-P1/2
17
  [-1, 1, Conv, [128, 3, 2]], # 1-P2/4
18
  [-1, 3, C3, [128]],
19
  [-1, 1, Conv, [256, 3, 2]], # 3-P3/8
20
- [-1, 9, C3, [256]],
21
  [-1, 1, Conv, [512, 3, 2]], # 5-P4/16
22
  [-1, 9, C3, [512]],
23
  [-1, 1, Conv, [768, 3, 2]], # 7-P5/32
24
  [-1, 3, C3, [768]],
25
  [-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
26
- [-1, 1, SPP, [1024, [3, 5, 7]]],
27
- [-1, 3, C3, [1024, False]], # 11
28
  ]
29
 
30
- # YOLOv5 head
31
  head:
32
  [[-1, 1, Conv, [768, 1, 1]],
33
  [-1, 1, nn.Upsample, [None, 2, 'nearest']],
 
10
  - [140,301, 303,264, 238,542] # P5/32
11
  - [436,615, 739,380, 925,792] # P6/64
12
 
13
+ # YOLOv5 v6.0 backbone
14
  backbone:
15
  # [from, number, module, args]
16
+ [[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
17
  [-1, 1, Conv, [128, 3, 2]], # 1-P2/4
18
  [-1, 3, C3, [128]],
19
  [-1, 1, Conv, [256, 3, 2]], # 3-P3/8
20
+ [-1, 6, C3, [256]],
21
  [-1, 1, Conv, [512, 3, 2]], # 5-P4/16
22
  [-1, 9, C3, [512]],
23
  [-1, 1, Conv, [768, 3, 2]], # 7-P5/32
24
  [-1, 3, C3, [768]],
25
  [-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
26
+ [-1, 3, C3, [1024]],
27
+ [-1, 1, SPPF, [1024, 5]], # 11
28
  ]
29
 
30
+ # YOLOv5 v6.0 head
31
  head:
32
  [[-1, 1, Conv, [768, 1, 1]],
33
  [-1, 1, nn.Upsample, [None, 2, 'nearest']],
models/hub/yolov5x6.yaml CHANGED
@@ -10,24 +10,24 @@ anchors:
10
  - [140,301, 303,264, 238,542] # P5/32
11
  - [436,615, 739,380, 925,792] # P6/64
12
 
13
- # YOLOv5 backbone
14
  backbone:
15
  # [from, number, module, args]
16
- [[-1, 1, Focus, [64, 3]], # 0-P1/2
17
  [-1, 1, Conv, [128, 3, 2]], # 1-P2/4
18
  [-1, 3, C3, [128]],
19
  [-1, 1, Conv, [256, 3, 2]], # 3-P3/8
20
- [-1, 9, C3, [256]],
21
  [-1, 1, Conv, [512, 3, 2]], # 5-P4/16
22
  [-1, 9, C3, [512]],
23
  [-1, 1, Conv, [768, 3, 2]], # 7-P5/32
24
  [-1, 3, C3, [768]],
25
  [-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
26
- [-1, 1, SPP, [1024, [3, 5, 7]]],
27
- [-1, 3, C3, [1024, False]], # 11
28
  ]
29
 
30
- # YOLOv5 head
31
  head:
32
  [[-1, 1, Conv, [768, 1, 1]],
33
  [-1, 1, nn.Upsample, [None, 2, 'nearest']],
 
10
  - [140,301, 303,264, 238,542] # P5/32
11
  - [436,615, 739,380, 925,792] # P6/64
12
 
13
+ # YOLOv5 v6.0 backbone
14
  backbone:
15
  # [from, number, module, args]
16
+ [[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
17
  [-1, 1, Conv, [128, 3, 2]], # 1-P2/4
18
  [-1, 3, C3, [128]],
19
  [-1, 1, Conv, [256, 3, 2]], # 3-P3/8
20
+ [-1, 6, C3, [256]],
21
  [-1, 1, Conv, [512, 3, 2]], # 5-P4/16
22
  [-1, 9, C3, [512]],
23
  [-1, 1, Conv, [768, 3, 2]], # 7-P5/32
24
  [-1, 3, C3, [768]],
25
  [-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
26
+ [-1, 3, C3, [1024]],
27
+ [-1, 1, SPPF, [1024, 5]], # 11
28
  ]
29
 
30
+ # YOLOv5 v6.0 head
31
  head:
32
  [[-1, 1, Conv, [768, 1, 1]],
33
  [-1, 1, nn.Upsample, [None, 2, 'nearest']],
models/yolov5l.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, Focus, [64, 3]], # 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, 9, 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, 1, SPP, [1024, [5, 9, 13]]],
24
- [-1, 3, C3, [1024, False]], # 9
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, C3, [1024]],
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/yolov5m.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, Focus, [64, 3]], # 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, 9, 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, 1, SPP, [1024, [5, 9, 13]]],
24
- [-1, 3, C3, [1024, False]], # 9
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, C3, [1024]],
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/yolov5n.yaml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+
3
+ # Parameters
4
+ nc: 80 # number of classes
5
+ depth_multiple: 0.33 # model depth multiple
6
+ width_multiple: 0.25 # layer channel multiple
7
+ anchors:
8
+ - [10,13, 16,30, 33,23] # P3/8
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 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/yolov5s.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, Focus, [64, 3]], # 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, 9, 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, 1, SPP, [1024, [5, 9, 13]]],
24
- [-1, 3, C3, [1024, False]], # 9
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, C3, [1024]],
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/yolov5x.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, Focus, [64, 3]], # 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, 9, 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, 1, SPP, [1024, [5, 9, 13]]],
24
- [-1, 3, C3, [1024, False]], # 9
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, C3, [1024]],
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']],