22import logging
33import albumentations as A
44from albumentations import GaussianBlur
5- from albumentations .augmentations .transforms import RandomBrightnessContrast
5+ from albumentations .augmentations import RandomBrightnessContrast
6+
67
78from donkeycar .config import Config
89
1112
1213
1314class ImageAugmentation :
14- def __init__ (self , cfg , key , prob = 0.5 , always_apply = False ):
15+ def __init__ (self , cfg , key , prob = 0.5 ):
1516 aug_list = getattr (cfg , key , [])
16- augmentations = [ImageAugmentation .create (a , cfg , prob , always_apply )
17+ augmentations = [ImageAugmentation .create (a , cfg , prob )
1718 for a in aug_list ]
1819 self .augmentations = A .Compose (augmentations )
1920
2021 @classmethod
21- def create (cls , aug_type : str , config : Config , prob , always ) -> \
22+ def create (cls , aug_type : str , config : Config , prob ) -> \
2223 albumentations .core .transforms_interface .BasicTransform :
2324 """ Augmentation factory. Cropping and trapezoidal mask are
2425 transformations which should be applied in training, validation
@@ -30,13 +31,13 @@ def create(cls, aug_type: str, config: Config, prob, always) -> \
3031 logger .info (f'Creating augmentation { aug_type } { b_limit } ' )
3132 return RandomBrightnessContrast (brightness_limit = b_limit ,
3233 contrast_limit = b_limit ,
33- p = prob , always_apply = always )
34+ p = prob )
3435
3536 elif aug_type == 'BLUR' :
3637 b_range = getattr (config , 'AUG_BLUR_RANGE' , 3 )
3738 logger .info (f'Creating augmentation { aug_type } { b_range } ' )
3839 return GaussianBlur (sigma_limit = b_range , blur_limit = (13 , 13 ),
39- p = prob , always_apply = always )
40+ p = prob )
4041
4142 # Parts interface
4243 def run (self , img_arr ):
0 commit comments