- class mmpretrain.models.utils.data_preprocessor.TwoNormDataPreprocessor(mean=None, std=None, second_mean=None, second_std=None, pad_size_divisor=1, pad_value=0, to_rgb=False, non_blocking=False)¶
Image pre-processor for CAE, BEiT v1/v2, etc.
Compared with the
mmselfsup.SelfSupDataPreprocessor, this module will normalize the prediction image and target image with different normalization parameters.
mean (Sequence[float or int], optional) – The pixel mean of image channels. If
to_rgb=Trueit means the mean value of R, G, B channels. If the length of mean is 1, it means all channels have the same mean value, or the input is a gray image. If it is not specified, images will not be normalized. Defaults to None.
std (Sequence[float or int], optional) – The pixel standard deviation of image channels. If
to_rgb=Trueit means the standard deviation of R, G, B channels. If the length of std is 1, it means all channels have the same standard deviation, or the input is a gray image. If it is not specified, images will not be normalized. Defaults to None.
pad_size_divisor (int) – The size of padded image should be divisible by
pad_size_divisor. Defaults to 1.
to_rgb (bool) – whether to convert image from BGR to RGB. Defaults to False.
non_blocking (bool) – Whether block current process when transferring data to device. Defaults to False.
- forward(data, training=False)¶
Performs normalization and bgr2rgb conversion based on
batch_inputsin forward function is a list.
- Data in the same format as the
- Return type: