From d9e2aabb6e6bb34974f904023d236b1fd8dd2ae2 Mon Sep 17 00:00:00 2001 From: Josafat-Mattias Burmeister Date: Thu, 16 Dec 2021 14:40:15 +0100 Subject: [PATCH] update prediction dir --- src/inferencing.py | 6 ++---- src/main.py | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/inferencing.py b/src/inferencing.py index 81a4bf37..94cf2aae 100644 --- a/src/inferencing.py +++ b/src/inferencing.py @@ -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, @@ -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}") diff --git a/src/main.py b/src/main.py index 0bf5296a..16b21367 100644 --- a/src/main.py +++ b/src/main.py @@ -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,