Albumentations
aug_tfms
icevision.tfms.albumentations.aug_tfms(
size,
presize=None,
horizontal_flip=HorizontalFlip(always_apply=False, p=0.5),
shift_scale_rotate=ShiftScaleRotate(
always_apply=False,
p=0.5,
shift_limit_x=(-0.0625, 0.0625),
shift_limit_y=(-0.0625, 0.0625),
scale_limit=(-0.09999999999999998, 0.10000000000000009),
rotate_limit=(-15, 15),
interpolation=1,
border_mode=4,
value=None,
mask_value=None,
),
rgb_shift=RGBShift(
always_apply=False, p=0.5, r_shift_limit=(-10, 10), g_shift_limit=(-10, 10), b_shift_limit=(-10, 10)
),
lighting=RandomBrightnessContrast(
always_apply=False,
p=0.5,
brightness_limit=(-0.2, 0.2),
contrast_limit=(-0.2, 0.2),
brightness_by_max=True,
),
blur=Blur(always_apply=False, p=0.5, blur_limit=(1, 3)),
crop_fn=functools.partial(RandomSizedBBoxSafeCrop, p=0.5),
pad=functools.partial(PadIfNeeded, border_mode=0, value=[124, 116, 104]),
)
Collection of useful augmentation transforms.
Arguments
- size
Union[int, Tuple[int, int]]
: The final size of the image. If anint
is given, the maximum size of the image is rescaled, maintaing aspect ratio. If atuple
is given, the image is rescaled to have that exact size (width, height). - presize
Optional[Union[int, Tuple[int, int]]]
: Rescale the image before applying other transfroms. IfNone
this transform is not applied. First introduced by fastai,this technique is explained in their book in this chapter (tip: search for "Presizing"). - horizontal_flip
Optional[albumentations.augmentations.transforms.HorizontalFlip]
: Flip around the y-axis. IfNone
this transform is not applied. - shift_scale_rotate
Optional[albumentations.augmentations.geometric.transforms.ShiftScaleRotate]
: Randomly shift, scale, and rotate. IfNone
this transform is not applied. - rgb_shift
Optional[albumentations.augmentations.transforms.RGBShift]
: Randomly shift values for each channel of RGB image. IfNone
this transform is not applied. - lighting
Optional[albumentations.augmentations.transforms.RandomBrightnessContrast]
: Randomly changes Brightness and Contrast. IfNone
this transform is not applied. - blur
Optional[albumentations.augmentations.transforms.Blur]
: Randomly blur the image. IfNone
this transform is not applied. - crop_fn
Optional[albumentations.core.transforms_interface.DualTransform]
: Randomly crop the image. IfNone
this transform is not applied. Usepartial
to saturate other parameters of the class. - pad
Optional[albumentations.core.transforms_interface.DualTransform]
: Pad the image tosize
, squaring the image ifsize
is anint
. IfNone
this transform is not applied. Usepartial
to sature other parameters of the class.
Returns
A list of albumentations transforms.
Adapter
icevision.tfms.albumentations.Adapter(tfms)
Helper class that provides a standard way to create an ABC using inheritance.