updates
This commit is contained in:
parent
eeae43c414
commit
388b66dcd0
19
train.py
19
train.py
|
@ -148,12 +148,13 @@ def train(
|
||||||
collate_fn=dataset.collate_fn)
|
collate_fn=dataset.collate_fn)
|
||||||
|
|
||||||
# Mixed precision training https://github.com/NVIDIA/apex
|
# Mixed precision training https://github.com/NVIDIA/apex
|
||||||
try:
|
mixed_precision = True
|
||||||
from apex import amp
|
if mixed_precision:
|
||||||
model, optimizer = amp.initialize(model, optimizer, opt_level='O1')
|
try:
|
||||||
mixed_precision = True
|
from apex import amp
|
||||||
except: # not installed: install help: https://github.com/NVIDIA/apex/issues/259
|
model, optimizer = amp.initialize(model, optimizer, opt_level='O1')
|
||||||
mixed_precision = False
|
except: # not installed: install help: https://github.com/NVIDIA/apex/issues/259
|
||||||
|
mixed_precision = False
|
||||||
|
|
||||||
# Start training
|
# Start training
|
||||||
model.hyp = hyp # attach hyperparameters to model
|
model.hyp = hyp # attach hyperparameters to model
|
||||||
|
@ -343,10 +344,10 @@ if __name__ == '__main__':
|
||||||
# Mutate hyperparameters
|
# Mutate hyperparameters
|
||||||
old_hyp = hyp.copy()
|
old_hyp = hyp.copy()
|
||||||
init_seeds(seed=int(time.time()))
|
init_seeds(seed=int(time.time()))
|
||||||
s = [.4, .4, .4, .4, .4, .4, .4, .4, .4 * 0, .4 * 0, .04 * 0, .4 * 0] # fractional sigmas
|
s = [.2, .2, .2, .2, .2, .2, .2, .2, .2 * 0, .2 * 0, .05 * 0, .2 * 0] # fractional sigmas
|
||||||
for i, k in enumerate(hyp.keys()):
|
for i, k in enumerate(hyp.keys()):
|
||||||
x = (np.random.randn(1) * s[i] + 1) ** 1.1 # plt.hist(x.ravel(), 100)
|
x = (np.random.randn(1) * s[i] + 1) ** 3.0 # plt.hist(x.ravel(), 300)
|
||||||
hyp[k] = hyp[k] * float(x) # vary by about 30% 1sigma
|
hyp[k] *= float(x) # vary by about 30% 1sigma
|
||||||
|
|
||||||
# Clip to limits
|
# Clip to limits
|
||||||
keys = ['lr0', 'iou_t', 'momentum', 'weight_decay']
|
keys = ['lr0', 'iou_t', 'momentum', 'weight_decay']
|
||||||
|
|
Loading…
Reference in New Issue