This commit is contained in:
Glenn Jocher 2019-08-25 02:25:05 +02:00
parent 14e67196ea
commit 5258ed8bdd
2 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ def create_modules(module_defs, img_size, arc):
elif arc == 'uCE': # unified CE (1 background + 80 classes)
b = [7, 0] # obj, cls
elif arc == 'uBCE': # unified BCE (80 classes)
b = [0, -4] # obj, cls
b = [0, -3.5] # obj, cls
bias = module_list[-1][0].bias.view(len(mask), -1) # 255 to 3x85
bias[:, 4] += b[0] # obj

View File

@ -322,8 +322,8 @@ def compute_loss(p, targets, model): # predictions, targets, model
# Define criteria
BCEcls = nn.BCEWithLogitsLoss(pos_weight=ft([h['cls_pw']]))
BCEobj = nn.BCEWithLogitsLoss(pos_weight=ft([h['obj_pw']]))
FBCE = FocalLoss(nn.BCEWithLogitsLoss())
FCE = FocalLoss(nn.CrossEntropyLoss()) # weight=model.class_weights
FBCE = nn.BCEWithLogitsLoss()
FCE = nn.CrossEntropyLoss() # weight=model.class_weights
# Compute losses
for i, pi in enumerate(p): # layer index, layer predictions