Skip to content

Commit

Permalink
Merge pull request #30 from tsugumi-sys/fix/evaluator
Browse files Browse the repository at this point in the history
Fix broken evaluator
  • Loading branch information
tsugumi-sys authored Jan 2, 2024
2 parents 5cdf782 + 2b0d658 commit c55e73c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions pipeline/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from torch.utils.data import DataLoader
from torchvision import transforms

from core.constants import DEVICE


class Evaluator:
def __init__(
Expand All @@ -25,11 +27,10 @@ def __init__(

def run(self):
with torch.no_grad():
for batch_idx, (input_frames, label_frames) in enumerate(
self.test_dataloader
):
pred_frames = self.model(input_frames)
self.visualize_predlabel_frames(batch_idx, label_frames, pred_frames)
for batch_idx, (input, label) in enumerate(self.test_dataloader):
input, label = input.to(DEVICE), label.to(DEVICE)
pred_frames = self.model(input)
self.visualize_predlabel_frames(batch_idx, label, pred_frames)
self.visualize_attention_maps(batch_idx)

def visualize_predlabel_frames(
Expand Down
2 changes: 1 addition & 1 deletion pipeline/moving_mnist/convlstm.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def main():
###
print("Evaluating ...")
evaluator = Evaluator(
model=None,
model=model,
test_dataloader=data_loaders.test_dataloader,
save_dir_path="./tmp/evaluate",
)
Expand Down

0 comments on commit c55e73c

Please sign in to comment.