basecls.data.rand_erase#
Random Erasing (Cutout)
Random Erasing: “Random Erasing Data Augmentation”
引用
rwightman/pytorch-image-models
- class basecls.data.rand_erase.RandomErasing(prob=0.5, scale_range=(0.02, 1 / 3), ratio=0.3, mode='const', count=1, num_splits=0, pad_mean=0.0, pad_std=1.0, *, order=None)[源代码]#
-
Randomly selects a rectangle region in an image and erases its pixels.
This variant of RandomErasing is intended to be applied to either a batch or single image tensor after it has been normalized by dataset mean and std.
- 参数
prob (
float
) – probability that Random Erasing operation will be performed. Default:0.5
scale_range (
Tuple
[float
,float
]) – percentage of erased area wrt input image area. Default:(0.02, 1.0 / 3)
ratio (
Union
[float
,Tuple
[float
,float
]]) – aspect ratio of erased area. if a scalar, range will be (ratio, 1.0 / ratio). Default:0.3
mode (
str
) – pixel color mode, one of “const”, “rand”, or “pixel”. Default:"const"
"const"
- erase block is constant color of 0 for all channels"rand"
- erase block is same per-channel random (normal) color"pixel"
- erase block is per-pixel random (normal) colorcount (
Union
[int
,Tuple
[int
,int
]]) – maximum number or range of erasing blocks per image, area per box is scaled by count. if a scalar, per-image count is randomly chosen between 1 and this value. if a range, per-image count is randomly chosen between this range. Default:1
num_splits (
int
) – augmentation splits. if > 1, the first split will not be erased. Default:0
pad_mean (
Union
[float
,Tuple
[float
,float
,float
]]) – the mean of padding pixels. Default:0.0
pad_std (
Union
[float
,Tuple
[float
,float
,float
]]) – the std of padding pixels. Default:1.0