From 0a3a761e8ef75458b5abfe384bd0370207f11cb1 Mon Sep 17 00:00:00 2001 From: Mingxin Zheng Date: Thu, 16 May 2024 14:01:07 +0000 Subject: [PATCH] Restrict Auto3DSeg fold input based on datalist Signed-off-by: Mingxin Zheng --- monai/apps/auto3dseg/auto_runner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monai/apps/auto3dseg/auto_runner.py b/monai/apps/auto3dseg/auto_runner.py index 05c961f999..5b6b501555 100644 --- a/monai/apps/auto3dseg/auto_runner.py +++ b/monai/apps/auto3dseg/auto_runner.py @@ -499,8 +499,8 @@ def set_num_fold(self, num_fold: int = 5) -> AutoRunner: if num_fold <= 0: raise ValueError(f"num_fold is expected to be an integer greater than zero. Now it gets {num_fold}") - if num_fold > self.max_fold + 1: - # Auto3DSeg allows no validation set, so the maximum fold number is max_fold + 1 + if num_fold > self.max_fold: + # Auto3DSeg must contain validation set, so the maximum fold number is max_fold. raise ValueError( f"num_fold is greater than the maximum fold number {self.max_fold} in {self.datalist_filename}." )