From 1249fcd8c3de9eedf66d62842c1b6eeb8115761c Mon Sep 17 00:00:00 2001 From: JosefBuchner Date: Tue, 7 Nov 2023 13:34:38 +0100 Subject: [PATCH 1/4] returns instance_dice of 0.0 instead of NaN --- panoptica/result.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panoptica/result.py b/panoptica/result.py index 09b9cbd..ca56b8b 100644 --- a/panoptica/result.py +++ b/panoptica/result.py @@ -171,7 +171,8 @@ def instance_dice(self) -> float: Returns: float: Average Dice coefficient. """ - return np.sum(self._dice_list) / self.tp + if self.tp == 0: return 0.0 + else: return np.sum(self._dice_list) / self.tp @property def instance_dice_sd(self) -> float: From f5542ea4698f0412cb0db251bb89bdda72cd5ade Mon Sep 17 00:00:00 2001 From: JosefBuchner Date: Tue, 7 Nov 2023 19:14:09 +0100 Subject: [PATCH 2/4] updated mean instance dice calculation --- panoptica/result.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panoptica/result.py b/panoptica/result.py index ca56b8b..e5fb347 100644 --- a/panoptica/result.py +++ b/panoptica/result.py @@ -172,7 +172,7 @@ def instance_dice(self) -> float: float: Average Dice coefficient. """ if self.tp == 0: return 0.0 - else: return np.sum(self._dice_list) / self.tp + else: return np.sum(self._dice_list) / (self.tp + self.fn) @property def instance_dice_sd(self) -> float: From e2ac9d55708ed2eff1dd3eb6b1f7990641467eeb Mon Sep 17 00:00:00 2001 From: JosefBuchner Date: Wed, 8 Nov 2023 11:16:36 +0100 Subject: [PATCH 3/4] Revert "updated mean instance dice calculation" This reverts commit f5542ea4698f0412cb0db251bb89bdda72cd5ade. --- panoptica/result.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panoptica/result.py b/panoptica/result.py index e5fb347..ca56b8b 100644 --- a/panoptica/result.py +++ b/panoptica/result.py @@ -172,7 +172,7 @@ def instance_dice(self) -> float: float: Average Dice coefficient. """ if self.tp == 0: return 0.0 - else: return np.sum(self._dice_list) / (self.tp + self.fn) + else: return np.sum(self._dice_list) / self.tp @property def instance_dice_sd(self) -> float: From 49a6c0a00067f1fb4558fdd6c6bd8e7df51be7cd Mon Sep 17 00:00:00 2001 From: JosefBuchner Date: Thu, 9 Nov 2023 10:27:27 +0100 Subject: [PATCH 4/4] Formatting aligned with remaining code --- panoptica/result.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/panoptica/result.py b/panoptica/result.py index ca56b8b..705f0c9 100644 --- a/panoptica/result.py +++ b/panoptica/result.py @@ -171,8 +171,9 @@ def instance_dice(self) -> float: Returns: float: Average Dice coefficient. """ - if self.tp == 0: return 0.0 - else: return np.sum(self._dice_list) / self.tp + if self.tp == 0: + return 0.0 + return np.sum(self._dice_list) / self.tp @property def instance_dice_sd(self) -> float: