This commit is contained in:
Glenn Jocher 2019-12-13 11:49:29 -08:00
parent 3f06fe6b12
commit 1bb738c83f
1 changed files with 10 additions and 12 deletions

View File

@ -321,17 +321,15 @@ def train():
final_epoch = epoch + 1 == epochs final_epoch = epoch + 1 == epochs
if opt.prebias: if opt.prebias:
print_model_biases(model) print_model_biases(model)
else: elif not opt.notest or final_epoch: # Calculate mAP
# Calculate mAP
if not opt.notest or final_epoch:
with torch.no_grad(): with torch.no_grad():
results, maps = test.test(cfg, results, maps = test.test(cfg,
data, data,
batch_size=batch_size, batch_size=batch_size,
img_size=opt.img_size, img_size=opt.img_size,
model=model, model=model,
conf_thres=0.001 if final_epoch and epoch > 0 else 0.1, # 0.1 for speed conf_thres=0.001 if final_epoch else 0.1, # 0.1 for speed
save_json=final_epoch and epoch > 0 and 'coco.data' in data, save_json=final_epoch and 'coco.data' in data and model.nc == 80,
dataloader=testloader) dataloader=testloader)
# Write epoch results # Write epoch results