From 9f7fe69206bd847c7d696f1f5caadc4d36aa8dd2 Mon Sep 17 00:00:00 2001 From: myron Date: Tue, 6 Jun 2023 20:47:02 -0700 Subject: [PATCH 1/2] ens sigm Signed-off-by: myron --- monai/apps/auto3dseg/auto_runner.py | 2 +- monai/apps/auto3dseg/ensemble_builder.py | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/monai/apps/auto3dseg/auto_runner.py b/monai/apps/auto3dseg/auto_runner.py index e1352bc426..4f2e441c24 100644 --- a/monai/apps/auto3dseg/auto_runner.py +++ b/monai/apps/auto3dseg/auto_runner.py @@ -276,7 +276,7 @@ def __init__( self.set_training_params() self.set_device_info() - self.set_prediction_params() + self.set_prediction_params({"sigmoid": self.data_src_cfg.get("sigmoid", False)}) self.set_analyze_params() self.set_ensemble_method() self.set_num_fold(num_fold=num_fold) diff --git a/monai/apps/auto3dseg/ensemble_builder.py b/monai/apps/auto3dseg/ensemble_builder.py index fa68342e0b..ad05b00d52 100644 --- a/monai/apps/auto3dseg/ensemble_builder.py +++ b/monai/apps/auto3dseg/ensemble_builder.py @@ -586,14 +586,10 @@ def ensemble(self): if len(infer_files) == 0: logger.info("No testing files for inference is provided. Ensembler ending.") return - infer_files = ( - partition_dataset(data=infer_files, shuffle=False, num_partitions=len(infer_files))[self.rank] - if self.rank < len(infer_files) - else [] - ) + infer_files = [infer_files[self.rank]] if self.rank < len(infer_files) else [] else: infer_files = partition_dataset( - data=infer_files, shuffle=False, num_partitions=self.world_size, even_divisible=True + data=infer_files, shuffle=False, num_partitions=self.world_size, even_divisible=False )[self.rank] # TO DO: Add some function in ensembler for infer_files update? From 6d727ba2795d869a3e14e45489465ae6715a9db0 Mon Sep 17 00:00:00 2001 From: myron Date: Wed, 7 Jun 2023 11:33:26 -0700 Subject: [PATCH 2/2] update sigmoid handling for ensembling Signed-off-by: myron --- monai/apps/auto3dseg/auto_runner.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/monai/apps/auto3dseg/auto_runner.py b/monai/apps/auto3dseg/auto_runner.py index 4f2e441c24..eeaf9f5570 100644 --- a/monai/apps/auto3dseg/auto_runner.py +++ b/monai/apps/auto3dseg/auto_runner.py @@ -276,7 +276,7 @@ def __init__( self.set_training_params() self.set_device_info() - self.set_prediction_params({"sigmoid": self.data_src_cfg.get("sigmoid", False)}) + self.set_prediction_params() self.set_analyze_params() self.set_ensemble_method() self.set_num_fold(num_fold=num_fold) @@ -292,6 +292,9 @@ def __init__( self.search_space: dict[str, dict[str, Any]] = {} self.hpo_tasks = 0 + if "sigmoid" not in self.kwargs and "sigmoid" in self.data_src_cfg: + self.kwargs["sigmoid"] = self.data_src_cfg["sigmoid"] + def read_cache(self): """ Check if the intermediate result is cached after each step in the current working directory