Skip to content

Commit

Permalink
Updated VOC hyperparameters (ultralytics#6732)
Browse files Browse the repository at this point in the history
* Update hyps

* Update hyp.VOC.yaml

* Update pathlib

* Update hyps

* Update hyps

* Update hyps

* Update hyps
  • Loading branch information
glenn-jocher authored Feb 22, 2022
1 parent cc4eb49 commit b74656c
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 75 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
# Hyperparameters for Objects365 training
# python train.py --weights yolov5m.pt --data Objects365.yaml --evolve
# See Hyperparameter Evolution tutorial for details https://github.com/ultralytics/yolov5#tutorials

lr0: 0.00258
lrf: 0.17
Expand Down
40 changes: 40 additions & 0 deletions data/hyps/hyp.VOC.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
# Hyperparameters for VOC training
# python train.py --batch 128 --weights yolov5m6.pt --data VOC.yaml --epochs 50 --img 512 --hyp hyp.scratch-med.yaml --evolve
# See Hyperparameter Evolution tutorial for details https://github.com/ultralytics/yolov5#tutorials

# YOLOv5 Hyperparameter Evolution Results
# Best generation: 319
# Last generation: 434
# metrics/precision, metrics/recall, metrics/mAP_0.5, metrics/mAP_0.5:0.95, val/box_loss, val/obj_loss, val/cls_loss
# 0.86236, 0.86184, 0.91274, 0.72647, 0.0077056, 0.0042449, 0.0013846

lr0: 0.0033
lrf: 0.15184
momentum: 0.74747
weight_decay: 0.00025
warmup_epochs: 3.4278
warmup_momentum: 0.59032
warmup_bias_lr: 0.18742
box: 0.02
cls: 0.21563
cls_pw: 0.5
obj: 0.50843
obj_pw: 0.6729
iou_t: 0.2
anchor_t: 3.4172
fl_gamma: 0.0
hsv_h: 0.01032
hsv_s: 0.5562
hsv_v: 0.28255
degrees: 0.0
translate: 0.04575
scale: 0.73711
shear: 0.0
perspective: 0.0
flipud: 0.0
fliplr: 0.5
mosaic: 0.87158
mixup: 0.04294
copy_paste: 0.0
anchors: 3.3556
39 changes: 0 additions & 39 deletions data/hyps/hyp.finetune.yaml

This file was deleted.

34 changes: 0 additions & 34 deletions data/hyps/hyp.scratch.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def parse_opt(known=False):
parser.add_argument('--weights', type=str, default=ROOT / 'yolov5s.pt', help='initial weights path')
parser.add_argument('--cfg', type=str, default='', help='model.yaml path')
parser.add_argument('--data', type=str, default=ROOT / 'data/coco128.yaml', help='dataset.yaml path')
parser.add_argument('--hyp', type=str, default=ROOT / 'data/hyps/hyp.scratch.yaml', help='hyperparameters path')
parser.add_argument('--hyp', type=str, default=ROOT / 'data/hyps/hyp.scratch-low.yaml', help='hyperparameters path')
parser.add_argument('--epochs', type=int, default=300)
parser.add_argument('--batch-size', type=int, default=16, help='total batch size for all GPUs, -1 for autobatch')
parser.add_argument('--imgsz', '--img', '--img-size', type=int, default=640, help='train, val image size (pixels)')
Expand Down
2 changes: 1 addition & 1 deletion utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ def print_mutation(results, hyp, save_dir, bucket, prefix=colorstr('evolve: ')):
# Download (optional)
if bucket:
url = f'gs://{bucket}/evolve.csv'
if gsutil_getsize(url) > (os.path.getsize(evolve_csv) if os.path.exists(evolve_csv) else 0):
if gsutil_getsize(url) > (evolve_csv.stat().st_size if evolve_csv.exists() else 0):
os.system(f'gsutil cp {url} {save_dir}') # download evolve.csv if larger than local

# Log to evolve.csv
Expand Down

0 comments on commit b74656c

Please sign in to comment.