-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Improvement] Support soft label for CrossEntropyLoss #625
[Improvement] Support soft label for CrossEntropyLoss #625
Conversation
Codecov Report
@@ Coverage Diff @@
## master #625 +/- ##
==========================================
+ Coverage 84.62% 84.63% +0.01%
==========================================
Files 127 127
Lines 8948 8958 +10
Branches 1503 1506 +3
==========================================
+ Hits 7572 7582 +10
Misses 1020 1020
Partials 356 356
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Some minor comments. |
Thanks for the PR~ Besides have u find some settings in which soft labels work in action recognition? I have tried to find one but failed. If you find such a setting, you can add the config file which uses soft label for training and achieves better results. |
Motivation
Soft labels are required for data augmentation methods like mixup, cutmix, etc. For now, official
CrossEntropyLoss
doesn't support soft labels.Details
[0, 1, 2]
[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]]
[[0.8, 0.2, 0, 0], [0.1, 0.9, 0, 0], [0, 0, 0.6, 0.4]]
Sparse
is borrowed from TensorFlow and MXNet, TensorFlow hasCategoricalCrossentropy
(accept non-sparse, one-hot like labels) andSparseCategorialCrossentropy
(just likeCrossEntropyLoss
in pytorch).TODO
CrossEntropyLoss
inmmaction/models/losses/cross_entropy_loss.py
.