I am working on a multi-label multi-class image classification problem. There are 15 labels in total, and each image can have either 1 or 0 corresponding to each label. So for eg, labels corresponding to an image can be [0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0]
The dataset is imbalanced, i.e. number of positive samples of each image are vastly different. So I wish to use a weighted loss function. I’m unable to understand its implementation in pytorch. Kindly help me out.
Hey @Harshit1097,
Let’s try to understand the problem at hand in a bit more depth.
Can you please elaborate as to what you meant by positive samples? This terminology is usually used when we have a binary image classification problem, i.e., we need to classify the image as having either class 1 (positive) or class 0 (negative). Now, your problem is a multi-class image classification problem, that too a multi-label one, so, how exactly are you specifying positive samples?
Is it like the number of images for the different class labels is vastly different from one another. For instance, label 1 has 10,000 images, while label 2 has only 100 images. I believe in this scenario, you perhaps wanted to state that:
The dataset is imbalanced, i.e. number of positive samples of each
imagelabel are vastly different.
By the way, for starters, you can check out this blog on Medium; seems like this blog serves your exact needs to me.
Cheers,
Elemento
Hi @Elemento . Yes I actually meant “label” instead of “image” in that sentence.
Thanks for the link!