Загрузка
Randomly select a rectangle region in the input image or video and erase its pixels. ‘Random Erasing Data Augmentation’ by Zhong et al. See https://arxiv.org/abs/1708.04896
p (float, optional) – probability that the random erasing operation will be performed.
scale (tuple of python:float, optional) – range of proportion of erased area against input image.
ratio (tuple of python:float, optional) – range of aspect ratio of erased area.
value (number or tuple of numbers) – erasing value. Default is 0. If a single int, it is used to erase all pixels. If a tuple of length 3, it is used to erase R, G, B channels respectively. If a str of ‘random’, erasing each pixel with random values.
inplace (bool, optional) – boolean to make this transform inplace. Default set to False.
Erased input.
>>> from torchvision.transforms import v2 as transforms
>>>
>>> transform = transforms.Compose([
>>> transforms.RandomHorizontalFlip(),
>>> transforms.PILToTensor(),
>>> transforms.ConvertImageDtype(torch.float),
>>> transforms
Get parameters for erase for a random erasing.
img (Tensor) – Tensor image to be erased.
scale (sequence) – range of proportion of erased area against input image.
ratio (sequence) – range of aspect ratio of erased area.
value (list, optional) – erasing value. If None, it is interpreted as “random”
(erasing each pixel with random values). If len(value) is 1, it is interpreted as a number,
i.e. value[0].
params (i, j, h, w, v) to be passed to erase for random erasing.