Describe the bug
When setting num_fold in AutoRunner, if the input datalist doesn't have "fold" field, it uses a hard coded number of folds, which is 5, and create randomly create folds for the datasets and save it in the datalist.
|
num_fold = 5 |
|
|
|
warnings.warn( |
|
f"Datalist has no folds specified {datalist_filename}..." |
|
f"Generating {num_fold} folds randomly." |
|
f"Please consider presaving fold numbers beforehand for repeated experiments." |
|
) |
|
|
|
from sklearn.model_selection import KFold |
|
|
|
kf = KFold(n_splits=num_fold, shuffle=True, random_state=0) |
|
for i, (_, valid_idx) in enumerate(kf.split(datalist["training"])): |
|
for vi in valid_idx: |
|
datalist["training"][vi]["fold"] = i |
|
|
|
ConfigParser.export_config_file(datalist, datalist_filename, fmt="json", indent=4) |
Although the input parameter is acknowledged and overwrite the five folds, the datalist is not created again.
|
num_fold = self.inspect_datalist_folds(datalist_filename=datalist_filename) |
|
if "num_fold" in self.data_src_cfg: |
|
num_fold = int(self.data_src_cfg["num_fold"]) # override from config |
Describe the bug
When setting
num_foldinAutoRunner, if the input datalist doesn't have "fold" field, it uses a hard coded number of folds, which is 5, and create randomly create folds for the datasets and save it in the datalist.MONAI/monai/apps/auto3dseg/auto_runner.py
Lines 418 to 433 in 782c1e6
Although the input parameter is acknowledged and overwrite the five folds, the datalist is not created again.
MONAI/monai/apps/auto3dseg/auto_runner.py
Lines 292 to 294 in 782c1e6