Skip to content

Commit

Permalink
fitness reverted to original
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored and Lechtr committed Apr 12, 2021
1 parent 19f3eec commit 6ecd721
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,21 +405,21 @@ def train(hyp, opt, device, tb_writer=None):
os.system('gsutil cp %s gs://%s/results/results%s.txt' % (results_file, opt.bucket, opt.name))

# Log
fi = fitness(np.array(results).reshape(1, -1)) # weighted combination of [P, R, mAP@.5, mAP@.5-.95]
# fi = fitness(np.array(results).reshape(1, -1)) # weighted combination of [P, R, mAP@.5, mAP@.5-.95]
tags = ['train/box_loss', 'train/obj_loss', 'train/cls_loss', # train loss
'metrics/precision', 'metrics/recall', 'metrics/mAP_0.5', 'metrics/mAP_0.5:0.95',
'val/box_loss', 'val/obj_loss', 'val/cls_loss', # val loss
'x/lr0', 'x/lr1', 'x/lr2',
'x/lr0', 'x/lr1', 'x/lr2']
# 'metrics/fitness'
] # params
for x, tag in zip(list(mloss[:-1]) + list(results) + lr, tags):# + list(fi), tags):
# ] # params
for x, tag in zip(list(mloss[:-1]) + list(results) + lr, tags): # + list(fi), tags):
if tb_writer:
tb_writer.add_scalar(tag, x, epoch) # tensorboard
if wandb_logger.wandb:
wandb_logger.log({tag: x}) # W&B

# Update best mAP
# fi = fitness(np.array(results).reshape(1, -1)) # weighted combination of [P, R, mAP@.5, mAP@.5-.95]
fi = fitness(np.array(results).reshape(1, -1)) # weighted combination of [P, R, mAP@.5, mAP@.5-.95]
if fi > best_fitness:
best_fitness = fi
wandb_logger.end_epoch(best_result=best_fitness == fi)
Expand Down

0 comments on commit 6ecd721

Please sign in to comment.