vis4d.data.reference¶
Reference View Sampling.
These Classes sample reference views from a dataset that contains videos. This is usually used when a model needs multiple samples of a video during training.
Functions
|
Sort views as key first. |
|
Sort views temporally. |
Classes
|
Dataset that samples reference views from a video dataset. |
|
Base reference view sampler. |
|
Sequential View Sampler. |
|
View Sampler that chooses reference views uniform at random. |
- class MultiViewDataset(dataset, sampler, sort_fn=<function sort_key_first>, num_retry=3, match_key='boxes2d_track_ids', skip_nomatch_samples=False)[source]¶
Dataset that samples reference views from a video dataset.
Creates an instance of the class.
- Parameters:
dataset (Dataset) – Video dataset to sample from.
sampler (ReferenceViewSampler) – Sampler that samples reference views.
sort_fn (SortingFunc, optional) – Function that sorts key and reference views. Defaults to sort_key_first.
num_retry (int, optional) – Number of retries if no match is found. Defaults to 3.
match_key (str, optional) – Key to match reference views with key view. Defaults to K.boxes2d_track_ids.
skip_nomatch_samples (bool, optional) – Whether to skip samples where no match is found. Defaults to False.
- class ReferenceViewSampler(num_ref_samples)[source]¶
Base reference view sampler.
Creates an instance of the class.
- Parameters:
num_ref_samples (int) – Number of reference views to sample.
- abstract __call__(key_dataset_index, indices_in_video, frame_ids)[source]¶
Sample num_ref_samples reference view indices.
- Parameters:
key_index (int) – Index of key view in the video.
indices_in_video (list[int]) – All dataset indices in the video.
frame_ids (list[int]) – Frame ids of all views in the video.
- Returns:
dataset indices of reference views.
- Return type:
list[int]
- class SequentialViewSampler(num_ref_samples)[source]¶
Sequential View Sampler.
Creates an instance of the class.
- Parameters:
num_ref_samples (int) – Number of reference views to sample.
- class UniformViewSampler(scope, num_ref_samples)[source]¶
View Sampler that chooses reference views uniform at random.
Creates an instance of the class.
- Parameters:
scope (int) – Define scope of neighborhood to key view to sample from.
num_ref_samples (int) – Number of reference views to sample.