From e347ec6e3694b9ccde4a3ebac1ee6630281bb399 Mon Sep 17 00:00:00 2001 From: Gabriel Gutierrez Date: Mon, 11 Nov 2024 01:17:15 -0300 Subject: [PATCH] Refactor SETR_PUP to streamline metric computation; unify loss calculation and metrics handling for improved clarity. --- minerva/models/nets/image/setr.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/minerva/models/nets/image/setr.py b/minerva/models/nets/image/setr.py index b7e5d33..9a39413 100644 --- a/minerva/models/nets/image/setr.py +++ b/minerva/models/nets/image/setr.py @@ -742,13 +742,10 @@ def _single_step(self, batch: torch.Tensor, batch_idx: int, step_name: str): x, y = batch if self.test_engine and (step_name == "test" or step_name == "val"): y_hat = self.test_engine(self.model, x) - loss = self._loss_func(y_hat, y.squeeze(1)) - metrics = self._compute_metrics(y_hat, y, step_name) else: y_hat = self.model(x) - metrics = self._compute_metrics(y_hat[0], y, step_name) - print(len(y_hat)) + metrics = self._compute_metrics(y_hat[0], y, step_name) loss = self._loss_func(y_hat, y.squeeze(1)) for metric_name, metric_value in metrics.items():