richardaecn / class-balanced-loss

Class-Balanced Loss Based on Effective Number of Samples. CVPR 2019
MIT License
597 stars 68 forks source link

weights = weights / np.sum(weights) * int(hparams['data_version']) #7

Open nikenj opened 4 years ago

nikenj commented 4 years ago

the weights normalize function is not in the paper, why in the code need normalized ? and why to
multiply the number of classes? ths .

richardaecn commented 4 years ago

The weight normalization is mentioned in the 3rd paragraph of "4. Class-Balanced Loss".

The vanilla loss could be viewed as having weight of 1 for all classes. This simple normalization strategy ensures the loss value is in the similar scale as the vanilla loss.