wutong16 / DistributionBalancedLoss

[ ECCV 2020 Spotlight ] Pytorch implementation for "Distribution-Balanced Loss for Multi-Label Classification in Long-Tailed Datasets"
362 stars 46 forks source link

About code implementation of eq7 #18

Open saishkomalla opened 2 years ago

saishkomalla commented 2 years ago

Hey thanks for the code 😄 but have some questions!!

https://github.com/wutong16/DistributionBalancedLoss/blob/14460d0acda6a3e77a8a6a5999b9746243cb1535/mllt/models/losses/resample_loss.py#L158-L160

Isn't this inconsistent with eq7

Screenshot 2022-10-28 at 2 25 03 AM

1) Like line 159 is dealing with the exp power in eq7 right? (Line 159) why are we directly multiplying it with labels, that anyhow occurs when we pass it to self.cls_criterion right? (same goes for weight)

2) Bit confused in name https://github.com/wutong16/DistributionBalancedLoss/blob/14460d0acda6a3e77a8a6a5999b9746243cb1535/mllt/models/losses/resample_loss.py#L113 Is cls_score here (logits passed through sigmoid/softmax) or just pure raw classifier outputs?, because even though we call it cls_score it's passed the to the same F.binary_cross_entropy_with_logits_loss