kaidic / LDAM-DRW

[NeurIPS 2019] Learning Imbalanced Datasets with Label-Distribution-Aware Margin Loss
https://arxiv.org/pdf/1906.07413.pdf
MIT License
647 stars 116 forks source link

Using gereral Resnet causes the loss to become ’nan‘ #20

Closed zh-jp closed 7 months ago

zh-jp commented 7 months ago

Thank you for your great work! I find the backone in your code isn't the general Resnet. They are very different from the general.

And I try to replace resnet32 in the paper mentioned with resnet34 but the loss cannot converge and turn to nan finally.

This is bash command I tried (resnet32 has been changed to resnet34 realized by torchvision)

python cifar_train.py --arch resnet32 --gpu 0 --imb_type exp --imb_factor 0.01 --loss_type LDAM --train_rule DRW

Could you please provide further explanation?

zh-jp commented 7 months ago

My apologize... the loss to become 'nan' is occured by lacking of class NormedLinear(nn.Module). And the paper said but I didn't notice: image