vis4d.data.samplers

Vis4D data samplers.

Classes

VideoInferenceSampler(dataset[, ...])

Produce sequence ordered indices for inference across all workers.

class VideoInferenceSampler(dataset, num_replicas=None, rank=None, shuffle=True, seed=0, drop_last=False)[source]

Produce sequence ordered indices for inference across all workers.

Inference needs to run on the __exact__ set of sequences and their respective samples, therefore if the sequences are not divisible by the number of workers or if they have different length, the sampler produces different number of samples on different workers.

Creates an instance of the class.

Parameters:
  • dataset (Dataset) – Inference dataset.

  • num_replicas (int, optional) – Number of processes participating in distributed training. By default, world_size is retrieved from the current distributed group.

  • rank (int, optional) – Rank of the current process within num_replicas. By default, rank is retrieved from the current distributed group.

  • shuffle (bool, optional) – If True (default), sampler will shuffle the indices.

  • seed (int, optional) – random seed used to shuffle the sampler if shuffle=True. This number should be identical across all processes in the distributed group. Default: 0.

  • drop_last (bool, optional) – if True, then the sampler will drop the tail of the data to make it evenly divisible across the number of replicas. If False, the sampler will add extra indices to make the data evenly divisible across the replicas. Default: False.

__iter__()[source]

Iteration method.

Return type:

Iterator[list[int]]

__len__()[source]

Return length of sampler instance.

Return type:

int