Skip to content

Commit

Permalink
fixed naming
Browse files Browse the repository at this point in the history
  • Loading branch information
talrid committed Oct 25, 2020
1 parent 56667a6 commit 60f5382
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,19 @@ def validate_multi(val_loader, model, args):

end = time.time()
tp, fp, fn, tn, count = 0, 0, 0, 0, 0
preds=[]
targets=[]
preds = []
targets = []
for i, (input, target) in enumerate(val_loader):
target = target
target = target.max(dim=1)[0]
# compute output
with torch.no_grad():
output = Sig(model(input.cuda())).cpu()

preds.append(target.cpu())
targets.append(output.cpu())
# for mAP calculation
preds.append(output.cpu())
targets.append(target.cpu())

# measure accuracy and record loss
pred = output.data.gt(args.thre).long()

Expand Down Expand Up @@ -149,7 +151,7 @@ def validate_multi(val_loader, model, args):
print(' * P_C {:.2f} R_C {:.2f} F_C {:.2f} P_O {:.2f} R_O {:.2f} F_O {:.2f}'
.format(mean_p_c, mean_r_c, mean_f_c, p_o, r_o, f_o))

mAP_score = mAP(torch.cat(preds).numpy(), torch.cat(targets).numpy())
mAP_score = mAP(torch.cat(targets).numpy(), torch.cat(preds).numpy())
print("mAP score:", mAP_score)

return
Expand Down

0 comments on commit 60f5382

Please sign in to comment.