clinicadl.split.Split

class clinicadl.split.Split(index: int, train_dataset: Dataset, val_dataset: Dataset, split_dir: Path | None = None)[source]

An object containing the data associated to a split.

More precisely, the dataclass contains the training and validation Dataset, as well as the split index and the split directory used to split the dataset.

Then, when build_train_loader() and build_val_loader() has been called, the training and validation DataLoader can be accessed.

property index: int

The index of the split.

property split_dir: Path | None

A potential split directory associated to this split.

property train_dataset: Dataset

The training dataset.

property val_dataset: Dataset

The validation dataset.

property train_loader: DataLoader

The training dataloader.

property val_loader: DataLoader

The validation dataloader.

build_train_loader(*, batch_size: int = 1, sampling_weights: str | None = None, shuffle: bool = True, num_workers: int = 0, pin_memory: bool = True, drop_last: bool = False, prefetch_factor: int | None = None, persistent_workers: bool = False, collate_fn: CollateFn | None = None) None[source]

Builds a DataLoader for the training set of the split.

See DataLoader for a description of the parameters.

build_val_loader(*, batch_size: int = 1, sampling_weights: str | None = None, shuffle: bool = False, num_workers: int = 0, pin_memory: bool = True, drop_last: bool = False, prefetch_factor: int | None = None, persistent_workers: bool = False, collate_fn: CollateFn | None = None) None[source]

Builds a DataLoader for the validation set of the split.

See DataLoader for a description of the parameters.