This commit is contained in:
Glenn Jocher 2019-12-28 21:58:05 -08:00
parent 2e680fb544
commit 5f9229ecaf
1 changed files with 2 additions and 2 deletions

View File

@ -372,8 +372,8 @@ def compute_loss(p, targets, model): # predictions, targets, model
# Define criteria # Define criteria
BCEcls = nn.BCEWithLogitsLoss(pos_weight=ft([h['cls_pw']]), reduction=red) BCEcls = nn.BCEWithLogitsLoss(pos_weight=ft([h['cls_pw']]), reduction=red)
BCEobj = nn.BCEWithLogitsLoss(pos_weight=ft([h['obj_pw']]), reduction=red) BCEobj = nn.BCEWithLogitsLoss(pos_weight=ft([h['obj_pw']]), reduction=red)
BCE = nn.BCEWithLogitsLoss() BCE = nn.BCEWithLogitsLoss(reduction=red)
CE = nn.CrossEntropyLoss() # weight=model.class_weights CE = nn.CrossEntropyLoss(reduction=red) # weight=model.class_weights
if 'F' in arc: # add focal loss if 'F' in arc: # add focal loss
g = h['fl_gamma'] g = h['fl_gamma']