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

Potential bug in masked_accuracy. #44

Closed
DuskNgai opened this issue Dec 28, 2023 · 2 comments
Closed

Potential bug in masked_accuracy. #44

DuskNgai opened this issue Dec 28, 2023 · 2 comments

Comments

@DuskNgai
Copy link

In src/membrain_seg/segmentation/training/metric_utils.py, I found when ignore_label is set to None, the function returns a nan. I examined the code and found that there may be a bug in your function masked_accuracy:

def masked_accuracy(...):
    ...
    mask = (
        y_gt == ignore_label
        if ignore_label is not None
        else torch.ones_like(y_gt).bool()
    )

I think it should be torch.zeros_like(y_gt).bool() instead of torch.ones_like(y_gt).bool().

Looking forward to your reply and hope it can be fixed soon~

@LorenzLamm
Copy link
Collaborator

Thanks a lot for pointing out! I never used it without setting the ignore label, so this didn't appear to me.
But you're absolutely correct. I fixed the bug in the latest PR (#45).

@LorenzLamm
Copy link
Collaborator

Merged now into the main repository, so closing this issue

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

No branches or pull requests

2 participants