updates
This commit is contained in:
parent
03c6fe1ffe
commit
831b6e39b6
4
train.py
4
train.py
|
@ -240,7 +240,7 @@ def train(
|
||||||
if not (opt.notest or (opt.nosave and epoch < 10)) or epoch == epochs - 1:
|
if not (opt.notest or (opt.nosave and epoch < 10)) or epoch == epochs - 1:
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
results, maps = test.test(cfg, data_cfg, batch_size=batch_size, img_size=opt.img_size, model=model,
|
results, maps = test.test(cfg, data_cfg, batch_size=batch_size, img_size=opt.img_size, model=model,
|
||||||
conf_thres=0.001)
|
conf_thres=0.1)
|
||||||
|
|
||||||
# Write epoch results
|
# Write epoch results
|
||||||
with open('results.txt', 'a') as file:
|
with open('results.txt', 'a') as file:
|
||||||
|
@ -341,7 +341,7 @@ if __name__ == '__main__':
|
||||||
for _ in range(gen):
|
for _ in range(gen):
|
||||||
# Get best hyperparameters
|
# Get best hyperparameters
|
||||||
x = np.loadtxt('evolve.txt', ndmin=2)
|
x = np.loadtxt('evolve.txt', ndmin=2)
|
||||||
fitness = x[:, 2] * 0.9 + x[:, 3] * 0.1 # fitness as weighted combination of mAP and F1
|
fitness = x[:, 2] * 0.5 + x[:, 3] * 0.5 # fitness as weighted combination of mAP and F1
|
||||||
x = x[fitness.argmax()] # select best fitness hyps
|
x = x[fitness.argmax()] # select best fitness hyps
|
||||||
for i, k in enumerate(hyp.keys()):
|
for i, k in enumerate(hyp.keys()):
|
||||||
hyp[k] = x[i + 5]
|
hyp[k] = x[i + 5]
|
||||||
|
|
Loading…
Reference in New Issue