glenn-jocher commited on
Commit
2692e67
β€’
1 Parent(s): a936f5f

Updated VOC hyperparameters (#6732)

Browse files

* Update hyps

* Update hyp.VOC.yaml

* Update pathlib

* Update hyps

* Update hyps

* Update hyps

* Update hyps

data/hyps/{hyp.finetune_objects365.yaml β†’ hyp.Objects365.yaml} RENAMED
@@ -1,4 +1,7 @@
1
  # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
 
 
 
2
 
3
  lr0: 0.00258
4
  lrf: 0.17
 
1
  # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Hyperparameters for Objects365 training
3
+ # python train.py --weights yolov5m.pt --data Objects365.yaml --evolve
4
+ # See Hyperparameter Evolution tutorial for details https://github.com/ultralytics/yolov5#tutorials
5
 
6
  lr0: 0.00258
7
  lrf: 0.17
data/hyps/hyp.VOC.yaml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+ # Hyperparameters for VOC training
3
+ # python train.py --batch 128 --weights yolov5m6.pt --data VOC.yaml --epochs 50 --img 512 --hyp hyp.scratch-med.yaml --evolve
4
+ # See Hyperparameter Evolution tutorial for details https://github.com/ultralytics/yolov5#tutorials
5
+
6
+ # YOLOv5 Hyperparameter Evolution Results
7
+ # Best generation: 319
8
+ # Last generation: 434
9
+ # metrics/precision, metrics/recall, metrics/mAP_0.5, metrics/mAP_0.5:0.95, val/box_loss, val/obj_loss, val/cls_loss
10
+ # 0.86236, 0.86184, 0.91274, 0.72647, 0.0077056, 0.0042449, 0.0013846
11
+
12
+ lr0: 0.0033
13
+ lrf: 0.15184
14
+ momentum: 0.74747
15
+ weight_decay: 0.00025
16
+ warmup_epochs: 3.4278
17
+ warmup_momentum: 0.59032
18
+ warmup_bias_lr: 0.18742
19
+ box: 0.02
20
+ cls: 0.21563
21
+ cls_pw: 0.5
22
+ obj: 0.50843
23
+ obj_pw: 0.6729
24
+ iou_t: 0.2
25
+ anchor_t: 3.4172
26
+ fl_gamma: 0.0
27
+ hsv_h: 0.01032
28
+ hsv_s: 0.5562
29
+ hsv_v: 0.28255
30
+ degrees: 0.0
31
+ translate: 0.04575
32
+ scale: 0.73711
33
+ shear: 0.0
34
+ perspective: 0.0
35
+ flipud: 0.0
36
+ fliplr: 0.5
37
+ mosaic: 0.87158
38
+ mixup: 0.04294
39
+ copy_paste: 0.0
40
+ anchors: 3.3556
data/hyps/hyp.finetune.yaml DELETED
@@ -1,39 +0,0 @@
1
- # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
- # Hyperparameters for VOC finetuning
3
- # python train.py --batch 64 --weights yolov5m.pt --data VOC.yaml --img 512 --epochs 50
4
- # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
5
-
6
- # Hyperparameter Evolution Results
7
- # Generations: 306
8
- # P R mAP.5 mAP.5:.95 box obj cls
9
- # Metrics: 0.6 0.936 0.896 0.684 0.0115 0.00805 0.00146
10
-
11
- lr0: 0.0032
12
- lrf: 0.12
13
- momentum: 0.843
14
- weight_decay: 0.00036
15
- warmup_epochs: 2.0
16
- warmup_momentum: 0.5
17
- warmup_bias_lr: 0.05
18
- box: 0.0296
19
- cls: 0.243
20
- cls_pw: 0.631
21
- obj: 0.301
22
- obj_pw: 0.911
23
- iou_t: 0.2
24
- anchor_t: 2.91
25
- # anchors: 3.63
26
- fl_gamma: 0.0
27
- hsv_h: 0.0138
28
- hsv_s: 0.664
29
- hsv_v: 0.464
30
- degrees: 0.373
31
- translate: 0.245
32
- scale: 0.898
33
- shear: 0.602
34
- perspective: 0.0
35
- flipud: 0.00856
36
- fliplr: 0.5
37
- mosaic: 1.0
38
- mixup: 0.243
39
- copy_paste: 0.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/hyps/hyp.scratch.yaml DELETED
@@ -1,34 +0,0 @@
1
- # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
- # Hyperparameters for COCO training from scratch
3
- # python train.py --batch 40 --cfg yolov5m.yaml --weights '' --data coco.yaml --img 640 --epochs 300
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)
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)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
train.py CHANGED
@@ -456,7 +456,7 @@ def parse_opt(known=False):
456
  parser.add_argument('--weights', type=str, default=ROOT / 'yolov5s.pt', help='initial weights path')
457
  parser.add_argument('--cfg', type=str, default='', help='model.yaml path')
458
  parser.add_argument('--data', type=str, default=ROOT / 'data/coco128.yaml', help='dataset.yaml path')
459
- parser.add_argument('--hyp', type=str, default=ROOT / 'data/hyps/hyp.scratch.yaml', help='hyperparameters path')
460
  parser.add_argument('--epochs', type=int, default=300)
461
  parser.add_argument('--batch-size', type=int, default=16, help='total batch size for all GPUs, -1 for autobatch')
462
  parser.add_argument('--imgsz', '--img', '--img-size', type=int, default=640, help='train, val image size (pixels)')
 
456
  parser.add_argument('--weights', type=str, default=ROOT / 'yolov5s.pt', help='initial weights path')
457
  parser.add_argument('--cfg', type=str, default='', help='model.yaml path')
458
  parser.add_argument('--data', type=str, default=ROOT / 'data/coco128.yaml', help='dataset.yaml path')
459
+ parser.add_argument('--hyp', type=str, default=ROOT / 'data/hyps/hyp.scratch-low.yaml', help='hyperparameters path')
460
  parser.add_argument('--epochs', type=int, default=300)
461
  parser.add_argument('--batch-size', type=int, default=16, help='total batch size for all GPUs, -1 for autobatch')
462
  parser.add_argument('--imgsz', '--img', '--img-size', type=int, default=640, help='train, val image size (pixels)')
utils/general.py CHANGED
@@ -795,7 +795,7 @@ def print_mutation(results, hyp, save_dir, bucket, prefix=colorstr('evolve: ')):
795
  # Download (optional)
796
  if bucket:
797
  url = f'gs://{bucket}/evolve.csv'
798
- if gsutil_getsize(url) > (os.path.getsize(evolve_csv) if os.path.exists(evolve_csv) else 0):
799
  os.system(f'gsutil cp {url} {save_dir}') # download evolve.csv if larger than local
800
 
801
  # Log to evolve.csv
 
795
  # Download (optional)
796
  if bucket:
797
  url = f'gs://{bucket}/evolve.csv'
798
+ if gsutil_getsize(url) > (evolve_csv.stat().st_size if evolve_csv.exists() else 0):
799
  os.system(f'gsutil cp {url} {save_dir}') # download evolve.csv if larger than local
800
 
801
  # Log to evolve.csv