Skip to content

Commit

Permalink
Refactor SETR_PUP to streamline metric computation; unify loss calcul…
Browse files Browse the repository at this point in the history
…ation and metrics handling for improved clarity.
  • Loading branch information
GabrielBG0 committed Nov 11, 2024
1 parent e196a13 commit e347ec6
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions minerva/models/nets/image/setr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit e347ec6

Please sign in to comment.