From 1bb738c83f363fdb654a2a5892b5675e35487a4a Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 13 Dec 2019 11:49:29 -0800 Subject: [PATCH] updates --- train.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/train.py b/train.py index ef991e2e..4fece807 100644 --- a/train.py +++ b/train.py @@ -321,18 +321,16 @@ def train(): final_epoch = epoch + 1 == epochs if opt.prebias: print_model_biases(model) - else: - # Calculate mAP - if not opt.notest or final_epoch: - with torch.no_grad(): - results, maps = test.test(cfg, - data, - batch_size=batch_size, - img_size=opt.img_size, - model=model, - conf_thres=0.001 if final_epoch and epoch > 0 else 0.1, # 0.1 for speed - save_json=final_epoch and epoch > 0 and 'coco.data' in data, - dataloader=testloader) + elif not opt.notest or final_epoch: # Calculate mAP + with torch.no_grad(): + results, maps = test.test(cfg, + data, + batch_size=batch_size, + img_size=opt.img_size, + model=model, + conf_thres=0.001 if final_epoch else 0.1, # 0.1 for speed + save_json=final_epoch and 'coco.data' in data and model.nc == 80, + dataloader=testloader) # Write epoch results with open(results_file, 'a') as f: