updates
This commit is contained in:
parent
e5ab942c14
commit
f356b9387e
|
@ -355,6 +355,11 @@ def compute_loss(p, targets, model): # predictions, targets, model
|
||||||
lcls += BCEcls(ps[:, 5:], t) # BCE
|
lcls += BCEcls(ps[:, 5:], t) # BCE
|
||||||
# lcls += CE(ps[:, 5:], tcls[i]) # CE
|
# lcls += CE(ps[:, 5:], tcls[i]) # CE
|
||||||
|
|
||||||
|
# Instance-class weighting (use with reduction='none')
|
||||||
|
# nt = t.sum(0) + 1 # number of targets per class
|
||||||
|
# lcls += (BCEcls(ps[:, 5:], t) / nt).mean() * nt.mean() # v1
|
||||||
|
# lcls += (BCEcls(ps[:, 5:], t) / nt[tcls[i]].view(-1,1)).mean() * nt.mean() # v2
|
||||||
|
|
||||||
# Append targets to text file
|
# Append targets to text file
|
||||||
# with open('targets.txt', 'a') as file:
|
# with open('targets.txt', 'a') as file:
|
||||||
# [file.write('%11.5g ' * 4 % tuple(x) + '\n') for x in torch.cat((txy[i], twh[i]), 1)]
|
# [file.write('%11.5g ' * 4 % tuple(x) + '\n') for x in torch.cat((txy[i], twh[i]), 1)]
|
||||||
|
|
Loading…
Reference in New Issue