vis4d.zoo.base.dataloader

Dataloader configuration.

Functions

get_inference_dataloaders_cfg(datasets_cfg)

Creates dataloader configuration given dataset for inference.

get_train_dataloader_cfg(dataset_cfg[, ...])

Creates dataloader configuration given dataset and preprocessing.

get_inference_dataloaders_cfg(datasets_cfg, samples_per_gpu=1, workers_per_gpu=1, video_based_inference=False, batchprocess_cfg=None, collate_fn=<function default_collate>, collate_keys=('seg_masks', 'extrinsics', 'intrinsics', 'depth_maps', 'optical_flows', 'categories'), sensors=None)[source]

Creates dataloader configuration given dataset for inference.

Parameters:
  • datasets_cfg (ConfigDict | list[ConfigDict]) – The configuration contains the single dataset or datasets.

  • samples_per_gpu (int | FieldReference, optional) – How many samples each GPU will process per batch. Defaults to 1.

  • workers_per_gpu (int | FieldReference, optional) – How many workers each GPU will spawn. Defaults to 1.

  • video_based_inference (bool | FieldReference , optional) – Whether to split dataset by sequences. Defaults to False.

  • batchprocess_cfg (ConfigDict, optional) – The config that contains the batch processing operations. Defaults to None. If None, ToTensor will be used.

  • collate_fn (GenericFunc, optional) – The collate function that will be used to stack the batch. Defaults to default_collate.

  • collate_keys (Sequence[str], optional) – The keys to collate. Defaults to DEFAULT_COLLATE_KEYS.

  • sensors (Sequence[str], optional) – The sensors to collate. Defaults to None.

Returns:

The dataloader configuration.

Return type:

ConfigDict

get_train_dataloader_cfg(dataset_cfg, preprocess_cfg=None, data_pipe=<class 'vis4d.data.data_pipe.DataPipe'>, samples_per_gpu=1, workers_per_gpu=1, batchprocess_cfg=None, collate_fn=<function default_collate>, collate_keys=('seg_masks', 'extrinsics', 'intrinsics', 'depth_maps', 'optical_flows', 'categories'), sensors=None, pin_memory=True, shuffle=True)[source]

Creates dataloader configuration given dataset and preprocessing.

Parameters:
  • dataset_cfg (ConfigDict) – The configuration that contains the dataset.

  • preprocess_cfg (ConfigDict) – The configuration that contains the preprocessing operations. Defaults to None. If None, no preprocessing will be applied.

  • samples_per_gpu (int | FieldReference, optional) – How many samples each GPU will process. Defaults to 1.

  • workers_per_gpu (int | FieldReference, optional) – How many workers to spawn per GPU. Defaults to 1.

  • data_pipe (DataPipe, optional) – The data pipe class to use. Defaults to DataPipe.

  • batchprocess_cfg (ConfigDict, optional) – The config that contains the batch processing operations. Defaults to None. If None, ToTensor will be used.

  • collate_fn (GenericFunc, optional) – The collate function to use. Defaults to default_collate.

  • collate_keys (Sequence[str], optional) – The keys to collate. Defaults to DEFAULT_COLLATE_KEYS.

  • sensors (Sequence[str], optional) – The sensors to collate. Defaults to None.

  • pin_memory (bool | FieldReference, optional) – Whether to pin memory. Defaults to True.

  • shuffle (bool | FieldReference, optional) – Whether to shuffle the dataset. Defaults to True.

Returns:

Configuration that can be instantiate as a dataloader.

Return type:

ConfigDict