vis4d.data.samplers
Vis4D data samplers.
Classes
|
A sampler wrapper for grouping images with similar aspect ratio. |
|
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.
- __init__(dataset, num_replicas=None, rank=None, shuffle=True, seed=0, drop_last=False)[source]
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_sizeis retrieved from the current distributed group.rank (int, optional) – Rank of the current process within
num_replicas. By default,rankis 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. IfFalse, the sampler will add extra indices to make the data evenly divisible across the replicas. Default:False.
- class AspectRatioBatchSampler(sampler, batch_size, drop_last=False)[source]
A sampler wrapper for grouping images with similar aspect ratio.
- Moidified from:
https://github.com/open-mmlab/mmdetection/blob/main/mmdet/datasets/samplers/batch_sampler.py
- Parameters:
sampler (Sampler) – Base sampler.
batch_size (int) – Size of mini-batch.
drop_last (bool) – If
True, the sampler will drop the last batch if its size would be less thanbatch_size.