Shortcuts

BatchAugSampler

class mmocr.datasets.samplers.BatchAugSampler(dataset, shuffle=True, num_repeats=3, seed=None)[源代码]

Sampler that repeats the same data elements for num_repeats times. The batch size should be divisible by num_repeats.

It ensures that different each augmented version of a sample will be visible to a different process (GPU). Heavily based on torch.utils.data.DistributedSampler.

This sampler was modified from https://github.com/facebookresearch/deit/blob/0c4b8f60/samplers.py Used in Copyright (c) 2015-present, Facebook, Inc.

参数
  • dataset (Sized) – The dataset.

  • shuffle (bool) – Whether shuffle the dataset or not. Defaults to True.

  • num_repeats (int) – The repeat times of every sample. Defaults to 3.

  • 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. Defaults to None.

set_epoch(epoch)[源代码]

Sets the epoch for this sampler.

When shuffle=True, this ensures all replicas use a different random ordering for each epoch. Otherwise, the next iteration of this sampler will yield the same ordering.

参数

epoch (int) – Epoch number.

返回类型

None

Read the Docs v: stable
Versions
latest
stable
0.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.