Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update prediction output #327

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cyto_dl/models/im2im/gan.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,12 @@ def predict_step(self, batch, batch_idx):
stage = "predict"
run_heads = self._get_run_heads(batch, stage)
outs = self.run_forward(batch, stage, self.should_save_image(batch_idx, stage), run_heads)
return outs[run_heads[0]]["save_path"]
# create input-> per head output mapping
io_map = {}
for head, output in outs.items():
head_io_map = output["save_path"]
for in_file, out_file in zip(head_io_map["input"], head_io_map["output"]):
if in_file not in io_map:
io_map[in_file] = {}
io_map[in_file][head] = out_file
return io_map
10 changes: 9 additions & 1 deletion cyto_dl/models/im2im/multi_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,12 @@ def predict_step(self, batch, batch_idx):
batch[k] = v.as_tensor()
run_heads = self._get_run_heads(batch, stage)
outs = self.run_forward(batch, stage, self.should_save_image(batch_idx, stage), run_heads)
return outs[run_heads[0]]["save_path"]
# create input-> per head output mapping
io_map = {}
for head, output in outs.items():
head_io_map = output["save_path"]
for in_file, out_file in zip(head_io_map["input"], head_io_map["output"]):
if in_file not in io_map:
io_map[in_file] = {}
io_map[in_file][head] = out_file
return io_map
Loading