FocalLoss() gamma and alpha default values

This commit is contained in:
Glenn Jocher 2020-03-13 16:51:30 -07:00
parent 208b9a73fe
commit 418269d739
2 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ hyp = {'giou': 3.54, # giou loss gain
'lrf': -4., # final LambdaLR learning rate = lr0 * (10 ** lrf)
'momentum': 0.937, # SGD momentum
'weight_decay': 0.000484, # optimizer weight decay
'fl_gamma': 0.5, # focal loss gamma
'fl_gamma': 1.5, # focal loss gamma
'hsv_h': 0.0138, # image HSV-Hue augmentation (fraction)
'hsv_s': 0.678, # image HSV-Saturation augmentation (fraction)
'hsv_v': 0.36, # image HSV-Value augmentation (fraction)

View File

@ -340,7 +340,7 @@ def wh_iou(wh1, wh2):
class FocalLoss(nn.Module):
# Wraps focal loss around existing loss_fcn() https://arxiv.org/pdf/1708.02002.pdf
# i.e. criteria = FocalLoss(nn.BCEWithLogitsLoss(), gamma=2.5)
def __init__(self, loss_fcn, gamma=0.5, alpha=1):
def __init__(self, loss_fcn, gamma=1.5, alpha=0.25):
super(FocalLoss, self).__init__()
self.loss_fcn = loss_fcn
self.gamma = gamma