File size: 426 Bytes
e170a8e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import albumentations as A
class Augmentor(object):
def __init__(self, is_training:bool):
self.augmentor = A.Compose([
A.MotionBlur(p=0.25),
A.ColorJitter(p=0.25),
A.ImageCompression(p=0.25),
A.ISONoise(p=0.25),
A.ToGray(p=0.1)
], p=float(is_training))
def __call__(self, x):
return self.augmentor(image=x)['image']
|