We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
To compute segmentation mask GeneralizedDice metrics one can use index tensors as stated by the documentation.
However, if the mask is filled by zeros the conversion to one_hot label will not work in the following lines:
if (target.bool() != target).any(): # target is an index tensor target = torch.nn.functional.one_hot(target, num_classes=num_classes).movedim(-1, 1)
Run the following code snippet:
import torch from torchmetrics.segmentation import GeneralizedDiceScore metric = GeneralizedDiceScore(num_classes=3) target = torch.zeros((2, 3, 3), dtype=torch.int64) predictions = torch.randint(0, 3, (2, 3, 3), dtype=torch.int64) metric(predictions, target) >>> RuntimeError: The size of tensor a (3) must match the size of tensor b (2) at non-singleton dimension 1
The expected behavior is to have the metric computed after the conversion of the target to a one-hot label.
The text was updated successfully, but these errors were encountered:
Hi! thanks for your contribution!, great first issue!
Sorry, something went wrong.
input_format
Successfully merging a pull request may close this issue.
🐛 Bug
To compute segmentation mask GeneralizedDice metrics one can use index tensors as stated by the documentation.
However, if the mask is filled by zeros the conversion to one_hot label will not work in the following lines:
To Reproduce
Run the following code snippet:
Expected behavior
The expected behavior is to have the metric computed after the conversion of the target to a one-hot label.
Environment
Additional context
The text was updated successfully, but these errors were encountered: