cyto_dl.datamodules.data_dict module#
- cyto_dl.datamodules.data_dict.make_data_dict_dataloader(data: Sequence[DictConfig | dict], transforms: Sequence[Callable] | Callable, cache_dir: UPath | str | None = None, **dataloader_kwargs)[source]#
Create a dataloader based on a dictionary of paths to images.
- Parameters:
data (Sequence[Union[DictConfig, dict]]) – A sequence of dictionaries, each containing a key expected by transforms (usually an image path)
transforms (Union[Sequence[Callable], Callable],) – Transforms to apply to each sample
cache_dir (Optional[Union[Path, str]] = None) – Path to a directory in which to store cached transformed inputs, to accelerate batch loading.
dataloader_kwargs – Additional keyword arguments are passed to the torch.utils.data.DataLoader class when instantiating it (aside from shuffle which is only used for the train dataloader). Among these args are num_workers, batch_size, shuffle, etc. See the PyTorch docs for more info on these args: https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader