Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --label-smoothing eps argument to train.py (default 0.0) #2344

Merged
merged 7 commits into from
Mar 29, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update loss.py
remove comment (too versbose)
  • Loading branch information
glenn-jocher committed Mar 29, 2021
commit cd3f4f67c36b3c447a21a7cba1f6da03065846c3
4 changes: 1 addition & 3 deletions utils/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ def __init__(self, model, autobalance=False):
BCEobj = nn.BCEWithLogitsLoss(pos_weight=torch.tensor([h['obj_pw']], device=device))

# Class label smoothing https://arxiv.org/pdf/1902.04103.pdf eqn 3
self.cp, self.cn = smooth_BCE(eps=h.get('label_smoothing', 0.0))

print(f'positive BCE target: {self.cp}, negative BCE target {self.cn}')
self.cp, self.cn = smooth_BCE(eps=h.get('label_smoothing', 0.0)) # positive, negative BCE targets

# Focal loss
g = h['fl_gamma'] # focal loss gamma
Expand Down