YyzHarry / imbalanced-regression

[ICML 2021, Long Talk] Delving into Deep Imbalanced Regression
http://dir.csail.mit.edu
MIT License
826 stars 130 forks source link

Bug when using huber/focal loss + LDS #21

Closed ming197 closed 2 years ago

ming197 commented 2 years ago

image

In loss.py, "weights" is the last parameter in function of weighted_huber_loss or weighted_focal

image

but in train.py,

loss = globals()[f"weighted_{args.loss}_loss"](outputs, targets, weights)

no atrribute name for weights

maybe it should be

loss = globals()[f"weighted_{args.loss}_loss"](outputs, targets, weights = weights)

or it would make mistakes when using huber + LDS or focal + LDS

YyzHarry commented 2 years ago

Hi - thanks for spotting the issue! The args of these loss functions were intended to keep the order of outputs, targets, weights. We did not carefully check the released code, but it has been updated now (a6fdc45d45c04e6f5c40f43925bc66e580911084).