vis4d.zoo.base

Model Zoo base.

get_callable_cfg(func, **kwargs)[source]

Return callable config.

Parameters:
  • func (GenericFunc) – Callable object.

  • **kwargs (ArgsType) – Keyword arguments to pass to the callable.

Returns:

Config for the callable.

Return type:

ConfigDict

get_default_callbacks_cfg(output_dir, checkpoint_period=1, epoch_based=True, refresh_rate=50)[source]

Get default callbacks config.

It will return a list of callbacks config including:
  • LoggingCallback

  • CheckpointCallback

Parameters:
  • output_dir (str | FieldReference) – Output directory.

  • checkpoint_period (int, optional) – Checkpoint period. Defaults to 1.

  • epoch_based (bool, optional) – Whether to use epoch based logging.

  • refresh_rate (int, optional) – Refresh rate for the logging. Defaults to 50.

Returns:

List of callbacks config.

Return type:

list[ConfigDict]

get_default_cfg(exp_name, work_dir='vis4d-workspace')[source]

Set default config for the project.

Parameters:
  • exp_name (str) – Experiment name.

  • work_dir (str, optional) – Working directory. Defaults to “vis4d-workspace”.

Returns:

Config for the project.

Return type:

ExperimentConfig

get_default_pl_trainer_cfg(config)[source]

Get PyTorch Lightning Trainer config.

Return type:

ExperimentConfig

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_lr_scheduler_cfg(scheduler, begin=0, end=-1, epoch_based=True, convert_epochs_to_steps=False, convert_attributes=None)[source]

Default learning rate scheduler configuration.

This creates a config object that can be initialized as a LearningRate scheduler for training.

Parameters:
  • scheduler (ConfigDict) – Learning rate scheduler configuration.

  • begin (int, optional) – Begin epoch. Defaults to 0.

  • end (int, optional) – End epoch. Defaults to None. Defaults to -1.

  • epoch_based (bool, optional) – Whether the learning rate scheduler is epoch based or step based. Defaults to True.

  • convert_epochs_to_steps (bool) – Whether to convert the begin and end for a step based scheduler to steps automatically based on length of train dataloader. Enables users to set the iteration breakpoints as epochs. Defaults to False.

  • convert_attributes (list[str] | None) – List of attributes in the scheduler that should be converted to steps. Defaults to None.

Returns:

Config dict that can be instantiated as LearningRate

scheduler.

Return type:

LrSchedulerConfig

get_optimizer_cfg(optimizer, lr_schedulers=None, param_groups=None)[source]

Default optimizer configuration.

This creates a config object that can be initialized as an Optimizer for training.

Parameters:
  • optimizer (ConfigDict) – Optimizer configuration.

  • lr_schedulers (list[LrSchedulerConfig] | None, optional) – Learning rate schedulers configuration. Defaults to None.

  • param_groups (list[ParamGroupCfg] | None, optional) – Parameter groups configuration. Defaults to None.

Returns:

Config dict that can be instantiated as Optimizer.

Return type:

OptimizerConfig

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

Modules

vis4d.zoo.base.callable

Callable objects for use in config files.

vis4d.zoo.base.data_connectors

Base data connectors.

vis4d.zoo.base.dataloader

Dataloader configuration.

vis4d.zoo.base.datasets

Model Zoo base datasets.

vis4d.zoo.base.models

Model Zoo base models.

vis4d.zoo.base.optimizer

Optimizer configuration.

vis4d.zoo.base.pl_trainer

Default runtime configuration for PyTorch Lightning.

vis4d.zoo.base.runtime

Default runtime configuration for the project.