-
Notifications
You must be signed in to change notification settings - Fork 234
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
Can dice and bce loss work on a multi-class task? #9
Comments
You're right. The current code uses BCE, so each pixel can have multiple classes i.e. multi-labels. To make it a single class for each pixel i.e. multi-class, you can use CE. I think you need to use reshape/view to 2d. |
Why are the metrics multiplied by the batch size, added cumulatively and then divided by the total number of samples during printing? It seems like this will print a scaled version of the average metric value (from print_metrics), depending on the batch size. Please correct me if I'm wrong. |
Hi, I am having a problem dealing with a multi-class task where dimensions are like these:
@ckolluru Have you created your loss function for multiclass already? |
The reason is some batches (i.e. the last batch) may have fewer training examples than all the other batches. Dividing the product
That's true! You may get a better insight into this topic by reading How is the loss for an epoch reported? |
If you want to use cross entropy make sure you're not applying sigmoid function beforehand. |
Thanks for the great implementation code.
I am confusing about the loss function. As far as I can see dice and bce are both used in binary-class task. Can they work well on multi-class task? From your code I can see the losses work ok, but what about bigger data set.
I tried
F.cross_entropy()
, but it gives me this:RuntimeError: 1only batches of spatial targets supported (non-empty 3D tensors) but got targets of size: : [36, 4, 224, 224]
. Could you please tell me whats wrong? thxThe text was updated successfully, but these errors were encountered: