vis4d.data.loader

Dataloader utility functions.

Functions

build_inference_dataloaders(datasets[, ...])

Build dataloaders for test / predict.

build_train_dataloader(dataset[, ...])

Build training dataloader.

default_collate(batch[, collate_keys, sensors])

Default batch collate.

default_pipeline(data)

Default data pipeline.

multi_sensor_collate(batch[, collate_keys, ...])

Default multi-sensor batch collate.

build_inference_dataloaders(datasets, samples_per_gpu=1, workers_per_gpu=1, video_based_inference=False, batchprocess_fn=<function default_pipeline>, collate_fn=<function default_collate>, collate_keys=('seg_masks', 'extrinsics', 'intrinsics', 'depth_maps', 'optical_flows', 'categories'), sensors=None)[source]

Build dataloaders for test / predict.

Return type:

list[DataLoader[Union[Dict[str, Any], list[Dict[str, Any]]]]]

build_train_dataloader(dataset, samples_per_gpu=1, workers_per_gpu=1, batchprocess_fn=<function default_pipeline>, collate_fn=<function default_collate>, collate_keys=('seg_masks', 'extrinsics', 'intrinsics', 'depth_maps', 'optical_flows', 'categories'), sensors=None, pin_memory=True, shuffle=True, seed=None, disable_subprocess_warning=False)[source]

Build training dataloader.

Return type:

DataLoader[Union[Dict[str, Any], list[Dict[str, Any]]]]

default_collate(batch, collate_keys=('seg_masks', 'extrinsics', 'intrinsics', 'depth_maps', 'optical_flows', 'categories'), sensors=None)[source]

Default batch collate.

It will concatenate images and stack seg_masks, extrinsics, intrinsics, and depth_maps. Other keys will be put into a list.

Parameters:
  • batch (list[DictData]) – List of data dicts.

  • collate_keys (Sequence[str]) – Keys to be collated. Default is DEFAULT_COLLATE_KEYS.

  • sensors (Sequence[str] | None) – List of sensors to collate. If is not None will raise an error. Default is None.

Returns:

Collated data dict.

Return type:

DictData

default_pipeline(data)[source]

Default data pipeline.

Return type:

list[Dict[str, Any]]

multi_sensor_collate(batch, collate_keys=('seg_masks', 'extrinsics', 'intrinsics', 'depth_maps', 'optical_flows', 'categories'), sensors=None)[source]

Default multi-sensor batch collate.

Parameters:
  • batch (list[DictData]) – List of data dicts. Each data dict contains data from multiple sensors.

  • collate_keys (Sequence[str]) – Keys to be collated. Default is DEFAULT_COLLATE_KEYS.

  • sensors (Sequence[str] | None) – List of sensors to collate. If None, will raise an error. Default is None.

Returns:

Collated data dict.

Return type:

DictData