Skip to content

Commit

Permalink
update prediction dir
Browse files Browse the repository at this point in the history
  • Loading branch information
josafatburmeister committed Dec 16, 2021
1 parent 1638ae4 commit d9e2aab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/inferencing.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def inference(self) -> None:
print(f"Inferencing is not implemented for the {self.dataset} dataset.")
return

output_folder_name = f"model-{str(uuid.uuid4())}"
output_dir = os.path.join(self.prediction_dir, output_folder_name)
os.mkdir(output_dir)
os.makedirs(self.prediction_dir, exist_ok=True)

image_paths, annotation_paths = BraTSDataModule.discover_paths(
dir_path=self.data_dir,
Expand Down Expand Up @@ -77,6 +75,6 @@ def inference(self) -> None:

img = nib.Nifti1Image(seg, np.eye(4))
file_name = os.path.basename(annotation_paths[i]).replace("seg", "pred")
path = os.path.join(output_dir, file_name)
path = os.path.join(self.prediction_dir, file_name)
nib.save(img, path)
print(f"Predictions stored in path {path}")
2 changes: 2 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ def run_active_learning_pipeline(
if checkpoint_dir is not None:
checkpoint_dir = os.path.join(checkpoint_dir, f"{wandb_logger.experiment.id}")

prediction_dir = os.path.join(prediction_dir, f"{wandb_logger.experiment.id}")

pipeline = ActiveLearningPipeline(
data_module,
model,
Expand Down

0 comments on commit d9e2aab

Please sign in to comment.