From e0e7e6fd88adf35acbb3692874f94ff841b2a861 Mon Sep 17 00:00:00 2001 From: Robert Kiewisz <56911280+RRobert92@users.noreply.github.com> Date: Fri, 28 Apr 2023 18:48:11 +0200 Subject: [PATCH] fix for metric mcov in trainig --- tardis_pytorch/dist_pytorch/trainer.py | 9 ++++++--- tardis_pytorch/utils/metrics.py | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tardis_pytorch/dist_pytorch/trainer.py b/tardis_pytorch/dist_pytorch/trainer.py index 93ea0912..e0537aaa 100644 --- a/tardis_pytorch/dist_pytorch/trainer.py +++ b/tardis_pytorch/dist_pytorch/trainer.py @@ -326,7 +326,8 @@ def _validate(self): input0_1 = self.Graph0_25.patch_to_segment( graph=edge_cpu, coord=coord, idx=out_cpu, prune=5, sort=False ) - mcov0_25.append(mcov(input0_1, target)) + mcov_m, _ = mcov(input0_1, target) + mcov0_25.append(mcov_m) except: mcov0_25.append(0.0) @@ -335,7 +336,8 @@ def _validate(self): input0_5 = self.Graph0_5.patch_to_segment( graph=edge_cpu, coord=coord, idx=out_cpu, prune=5, sort=False ) - mcov0_5.append(mcov(input0_5, target)) + mcov_m, _ = mcov(input0_5, target) + mcov0_5.append(mcov_m) except: mcov0_5.append(0.0) @@ -344,7 +346,8 @@ def _validate(self): input0_9 = self.Graph0_9.patch_to_segment( graph=edge_cpu, coord=coord, idx=out_cpu, prune=5, sort=False ) - mcov0_9.append(mcov(input0_9, target)) + mcov_m = mcov(input0_9, target) + mcov0_9.append(mcov_m) except: mcov0_9.append(0.0) diff --git a/tardis_pytorch/utils/metrics.py b/tardis_pytorch/utils/metrics.py index 60f611ef..59fd3083 100644 --- a/tardis_pytorch/utils/metrics.py +++ b/tardis_pytorch/utils/metrics.py @@ -328,14 +328,12 @@ def mcov( # Get GT instances, compute IoU for best mach between GT and input for j in unique_target: - print(j) g = targets[targets[:, 0] == j, 1:] # Pick GT instance w_g = g.shape[0] / targets.shape[0] # ratio of instance to whole PC iou = [] # Select max IoU (the best mach) for i in unique_input: - print(i) p = input[input[:, 0] == i, 1:] # Pick input instance # Intersection of coordinates between GT and input instances