Skip to content

Commit

Permalink
accumulate_crossval_results_entry_point
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianIsensee committed Aug 19, 2022
1 parent 4656544 commit af7d8c0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions nnunetv2/evaluation/find_best_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,33 @@ def find_best_configuration_entry_point():
strict=False)


def accumulate_crossval_results_entry_point():
parser = argparse.ArgumentParser('Copies all predicted segmentations from the individual folds into one joint '
'folder and evaluates them')
parser.add_argument('dataset_name_or_id', type=str, help='Dataset Name or id')
parser.add_argument('-c', type=str, required=True,
default='3d_fullres',
help="Configuration")
parser.add_argument('-o', type=str, required=False, default=None,
help="Output folder. If not specified, the output folder will be located in the trained " \
"model directory (named crossval_results_folds_XXX).")
parser.add_argument('-f', nargs='+', type=int, default=(0, 1, 2, 3, 4),
help='Folds to use. Default: 0 1 2 3 4')
parser.add_argument('-p', type=str, required=False, default='nnUNetPlans',
help='Plan identifier in which to search for the specified configuration. Default: nnUNetPlans')
parser.add_argument('-tr', type=str, required=False, default='nnUNetTrainer',
help='Trainer class. Default: nnUNetTrainer')
args = parser.parse_args()
trained_model_folder = get_output_folder(args.dataset_name_or_id, args.tr, args.p, args.c)

if args.o is None:
merged_output_folder = join(trained_model_folder, f'crossval_results_folds_{folds_tuple_to_string(args.f)}')
else:
merged_output_folder = args.o

accumulate_cv_results(trained_model_folder, merged_output_folder, args.f)


if __name__ == '__main__':
find_best_configuration(4,
default_trained_models,
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
'nnUNetv2_determine_postprocessing = nnunetv2.postprocessing.remove_connected_components:entry_point_determine_postprocessing_folder',
'nnUNetv2_apply_postprocessing = nnunetv2.postprocessing.remove_connected_components:entry_point_apply_postprocessing',
'nnUNetv2_ensemble = nnunetv2.ensembling.ensemble:entry_point_ensemble_folders',
'nnUNetv2_accumulate_crossval_results = nnunetv2.evaluation.find_best_configuration:accumulate_crossval_results_entry_point'
],
},
keywords=['deep learning', 'image segmentation', 'medical image analysis',
Expand Down

0 comments on commit af7d8c0

Please sign in to comment.