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

Question about metric #18

Open
Lycus99 opened this issue Jun 4, 2024 · 1 comment
Open

Question about metric #18

Lycus99 opened this issue Jun 4, 2024 · 1 comment

Comments

@Lycus99
Copy link

Lycus99 commented Jun 4, 2024

Thanks for your work.
I have a question about the metric used in TransUNet. In the /TransUNet/trainer.py file, I found the metrics defined as follows:

def calculate_metric_percase(pred, gt):
pred[pred > 0] = 1
gt[gt > 0] = 1
if pred.sum() > 0 and gt.sum() > 0:
dice = medpy.metric.binary.dc(pred, gt)
hd95 = medpy.metric.binary.hd95(pred, gt)
return dice, hd95
elif pred.sum() > 0 and gt.sum() == 0:
return 1., 0.
else:
return 0., 0.

I think when pred.sum()==0 and gt.sum()==0, the dice score should be 1.0, not 0.0, and when pred.sum()>0 and gt.sum()==0, the dice score should be calculated by taking the complement of the original pred and gt.

@Kyfafyd
Copy link
Member

Kyfafyd commented Jun 5, 2024

Hi @Lycus99 , thanks for your interest!
For this metric, we directly adopt it from https://github.com/Beckschen/TransUNet, you can refer to this discussion: Beckschen/TransUNet#39

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