Skip to content

Random folding in Auto3DSeg AutoRunner doesn't acknowledge num_fold input #7206

Description

@bhashemian

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions