-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DiceLoss when multiclass mode throwing an assertion error #889
Comments
Hi @Foundsheep, thanks for the question! Multiclass - multiple classes, but one class per pixel, image should be represented as BS, H, W. Each pixel value should encode class value. For example if we have 3 classes we might have pixel values 0,1,2. Please let me know if this is not clear :) |
@qubvel Thanks for the answer. It is now clear how it went wrong. But, I've got a question, which might be not related to this repository, but rather a theoretical one. Let's say, if we choose to go for This is just a curiosity, I now have my issue resolved, so feel free to comment on this. |
You should use |
|
@qubvel thanks for the reply. So, if we're to use @ljb-1 I think it's up to your choice. |
This actually helped me out, thanks ALOT for your response man! |
Thanks for clarifying. The documentation needs to be updated - https://smp.readthedocs.io/en/latest/losses.html#diceloss mentions y_true - torch.Tensor of shape (N, H, W) or (N, C, H, W) |
Agree, docs have to be more clear, would appreciate PR if anyone have a bandwidth! Thanks for this discussion 🤗 |
@qubvel I will try to do that later when I've got a bandwidth :) Just to make sure, how could the documentation be clarified in terms of where to modify. Would it be |
Hey @Foundsheep! It's up tou you, in any way you think it will make it clear 🤗 |
my circumstance is as follows and they are just examplary code:
but the above code throws an error below.
When I saw the code in
dice.py
it seems like inmulticlass
mode,y_true
andy_pred
are supposed to result in different shapes inherently.Is there a reason for that? If what I'm thinking is right,
multiclass
is different frommultilabel
andmulticlass
assumes that there are multiple classes this segmentation pixels could belong to, but it will be only one class per each pixel, andmultilabel
assumes that those pixels have more than one class per each, which means the above code should be modified.If there's anything I got wrong about, please let me know
The text was updated successfully, but these errors were encountered: