Skip to content

Commit

Permalink
Merge remote-tracking branch 'mzenk/fix_accumulate_cv'
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianIsensee committed Jun 7, 2024
2 parents 3b284d7 + 065f45a commit 1cc001f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nnunetv2/evaluation/find_best_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
from copy import deepcopy
from typing import Union, List, Tuple

from batchgenerators.utilities.file_and_folder_operations import load_json, join, isdir, save_json

from batchgenerators.utilities.file_and_folder_operations import (
load_json, join, isdir, listdir, save_json
)
from nnunetv2.configuration import default_num_processes
from nnunetv2.ensembling.ensemble import ensemble_crossvalidations
from nnunetv2.evaluation.accumulate_cv_results import accumulate_cv_results
Expand Down Expand Up @@ -320,6 +321,11 @@ def accumulate_crossval_results_entry_point():
merged_output_folder = join(trained_model_folder, f'crossval_results_folds_{folds_tuple_to_string(args.f)}')
else:
merged_output_folder = args.o
if isdir(merged_output_folder) and len(listdir(merged_output_folder)) > 0:
raise FileExistsError(
f"Output folder {merged_output_folder} exists and is not empty. "
f"To avoid data loss, nnUNet requires an empty output folder."
)

accumulate_cv_results(trained_model_folder, merged_output_folder, args.f)

Expand Down

0 comments on commit 1cc001f

Please sign in to comment.