glenn-jocher
commited on
Commit
•
f1096b2
1
Parent(s):
305c6a0
hyperparameter evolution update (#566)
Browse files
train.py
CHANGED
@@ -213,6 +213,7 @@ def train(hyp, opt, device, tb_writer=None):
|
|
213 |
# Start training
|
214 |
t0 = time.time()
|
215 |
nw = max(3 * nb, 1e3) # number of warmup iterations, max(3 epochs, 1k iterations)
|
|
|
216 |
maps = np.zeros(nc) # mAP per class
|
217 |
results = (0, 0, 0, 0, 0, 0, 0) # 'P', 'R', 'mAP', 'F1', 'val GIoU', 'val Objectness', 'val Classification'
|
218 |
scheduler.last_epoch = start_epoch - 1 # do not move
|
@@ -477,8 +478,8 @@ if __name__ == '__main__':
|
|
477 |
'anchor_t': (1, 2.0, 8.0), # anchor-multiple threshold
|
478 |
'fl_gamma': (0, 0.0, 2.0), # focal loss gamma (efficientDet default gamma=1.5)
|
479 |
'hsv_h': (1, 0.0, 0.1), # image HSV-Hue augmentation (fraction)
|
480 |
-
'hsv_s': (1, 0.0, 0.
|
481 |
-
'hsv_v': (1, 0.0, 0.
|
482 |
'degrees': (1, 0.0, 45.0), # image rotation (+/- deg)
|
483 |
'translate': (1, 0.0, 0.9), # image translation (+/- fraction)
|
484 |
'scale': (1, 0.0, 0.9), # image scale (+/- gain)
|
@@ -495,7 +496,7 @@ if __name__ == '__main__':
|
|
495 |
if opt.bucket:
|
496 |
os.system('gsutil cp gs://%s/evolve.txt .' % opt.bucket) # download evolve.txt if exists
|
497 |
|
498 |
-
for _ in range(
|
499 |
if os.path.exists('evolve.txt'): # if evolve.txt exists: select best hyps and mutate
|
500 |
# Select parent(s)
|
501 |
parent = 'single' # parent selection method: 'single' or 'weighted'
|
|
|
213 |
# Start training
|
214 |
t0 = time.time()
|
215 |
nw = max(3 * nb, 1e3) # number of warmup iterations, max(3 epochs, 1k iterations)
|
216 |
+
# nw = min(nw, (epochs - start_epoch) / 2 * nb) # limit warmup to < 1/2 of training
|
217 |
maps = np.zeros(nc) # mAP per class
|
218 |
results = (0, 0, 0, 0, 0, 0, 0) # 'P', 'R', 'mAP', 'F1', 'val GIoU', 'val Objectness', 'val Classification'
|
219 |
scheduler.last_epoch = start_epoch - 1 # do not move
|
|
|
478 |
'anchor_t': (1, 2.0, 8.0), # anchor-multiple threshold
|
479 |
'fl_gamma': (0, 0.0, 2.0), # focal loss gamma (efficientDet default gamma=1.5)
|
480 |
'hsv_h': (1, 0.0, 0.1), # image HSV-Hue augmentation (fraction)
|
481 |
+
'hsv_s': (1, 0.0, 0.9), # image HSV-Saturation augmentation (fraction)
|
482 |
+
'hsv_v': (1, 0.0, 0.9), # image HSV-Value augmentation (fraction)
|
483 |
'degrees': (1, 0.0, 45.0), # image rotation (+/- deg)
|
484 |
'translate': (1, 0.0, 0.9), # image translation (+/- fraction)
|
485 |
'scale': (1, 0.0, 0.9), # image scale (+/- gain)
|
|
|
496 |
if opt.bucket:
|
497 |
os.system('gsutil cp gs://%s/evolve.txt .' % opt.bucket) # download evolve.txt if exists
|
498 |
|
499 |
+
for _ in range(100): # generations to evolve
|
500 |
if os.path.exists('evolve.txt'): # if evolve.txt exists: select best hyps and mutate
|
501 |
# Select parent(s)
|
502 |
parent = 'single' # parent selection method: 'single' or 'weighted'
|