Shortcuts

SelfSupDataPreprocessor

class mmpretrain.models.utils.data_preprocessor.SelfSupDataPreprocessor(mean=None, std=None, pad_size_divisor=1, pad_value=0, to_rgb=False, bgr_to_rgb=False, rgb_to_bgr=False, non_blocking=False)[source]

Image pre-processor for operations, like normalization and bgr to rgb.

Compared with the mmengine.ImgDataPreprocessor, this module supports inputs as torch.Tensor or a list of torch.Tensor.

forward(data, training=False)[source]

Performs normalization and bgr2rgb conversion based on BaseDataPreprocessor.

Parameters:
  • data (dict) – data sampled from dataloader.

  • training (bool) – Whether to enable training time augmentation. If subclasses override this method, they can perform different preprocessing strategies for training and testing based on the value of training.

Returns:

Data in the same format as the model input.

Return type:

Tuple[torch.Tensor, Optional[list]]

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

Free document hosting provided by Read the Docs.