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

Change image_utils.py to work with nnunetv2 predictions and ground truth labels with multi-class segmentations. #17

Merged
merged 8 commits into from
May 6, 2024

Conversation

NataliaAlves13
Copy link
Contributor

The framework accepts .npz predictions with the "probabilities" key as produced by nnunetv2.
The framework accepts ground truth labels with multi-class segmentations and assumes that the lesion segmentations correspond to label=1.

@joeranbosma joeranbosma self-requested a review April 23, 2024 14:39
Copy link
Collaborator

@joeranbosma joeranbosma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the proposed changes, great to make it compatible with nnU-Net v2!

The change results in predictions being loaded from disk twice (first to try with 'softmax' key, then with 'probabilities' key) for v2. Could you update it to:

# read the nnU-Net format
data = np.load(path)
data = data["softmax"] if "softmax" in data else data["probabilities"]
return data.astype("float32")[1]

I'm a bit worried about the final change, lbl[lbl!=1]=0. This would lead to unexpected behaviour when labels > 1 are used.

@joeranbosma joeranbosma merged commit f35b470 into DIAGNijmegen:main May 6, 2024
4 checks passed
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