Class-balanced-loss-pytorch icon indicating copy to clipboard operation
Class-balanced-loss-pytorch copied to clipboard

why is no_of_classes needed for weights normialisation

Open m-zheng opened this issue 3 years ago • 2 comments

Hi @vandit15,

Thanks for sharing your code.

In line 73, weights = weights / np.sum(weights) * no_of_classes, why is no_of_classes included here to normalise the weights? Any help would be thankful.

Thanks

m-zheng avatar Jun 02 '21 14:06 m-zheng

I have the same question. Do you have resolved it?

Wangbenzhi avatar Jul 22 '22 02:07 Wangbenzhi

It is not needed, @m-zheng @Wangbenzhi refer to https://github.com/fcakyon/balanced-loss for improved and maintained version

fcakyon avatar Jul 22 '22 13:07 fcakyon

The article in Section 4 has mentioned that. They normalize the sum of \alpha to C, whicH C is the total number of classes

zhandand avatar Sep 07 '22 03:09 zhandand