opr.samplers package

Module for samplers.

opr.samplers.batch_sampler

Batch sampler from MinkLoc method.

Code adopted from repository: https://github.com/jac99/MinkLocMultimodal, MIT License

class opr.samplers.batch_sampler.BatchSampler(dataset: BasePlaceRecognitionDataset, batch_size: int, batch_size_limit: int | None = None, batch_expansion_rate: float | None = None, max_batches: int | None = None, positives_per_group: int = 2, seed: int | None = None, drop_last: bool = True)[source]

Bases: Sampler

Sampler returning list of indices to form a mini-batch.

Samples elements in groups consisting of k=2 similar elements (positives) Batch has the following structure: item1_1, …, item1_k, item2_1, … item2_k, itemn_1, …, itemn_k

expand_batch() None[source]

Batch expansion method. See MinkLoc paper for details about dynamic batch sizing.

generate_batches() None[source]

Generate training/evaluation batches.

is_batches_generated: bool = False
class opr.samplers.batch_sampler.DistributedBatchSamplerWrapper(sampler: BatchSampler, num_replicas: int | None = None, rank: int | None = None)[source]

Bases: Sampler

Wrapper for BatchSampler that supports distributed batch sampling.