Skip to content
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

Update class indices in MoNuSAC to make compatible with generalized dice metric #678

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

nkaenzig
Copy link
Collaborator

@nkaenzig nkaenzig commented Oct 10, 2024

Monusac evaluation is not compatible with current metrics implementation:

File "eva-worktrees/eva/src/eva/vision/metrics/segmentation/generalized_dice.py", line 56, in update
    target = _utils.index_to_one_hot(target, num_classes=self.orig_num_classes)
  File "eva-worktrees/eva/src/eva/vision/metrics/segmentation/_utils.py", line 48, in index_to_one_hot
    tensor = torch.nn.functional.one_hot(tensor.long(), num_classes=num_classes).movedim(-1, 1)
RuntimeError: Class values must be smaller than num_classes.

The issue was that the ambigous class was mapped to a 255, which is problematic when converting the target tensor to one-hot format.

@nkaenzig nkaenzig changed the title Fix class indices MoNuSAC to make compatible with generalized dice metric Update class indices in MoNuSAC to make compatible with generalized dice metric Oct 10, 2024
@nkaenzig nkaenzig marked this pull request as ready for review October 10, 2024 08:50
@nkaenzig nkaenzig enabled auto-merge (squash) October 10, 2024 08:54
@nkaenzig nkaenzig merged commit 26f38dd into main Oct 10, 2024
6 checks passed
@nkaenzig nkaenzig deleted the fix-monusac branch October 10, 2024 08:55
@nkaenzig nkaenzig self-assigned this Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants