def __init__(self): self.imgaug_transform = iaa.Add((127, 127), per_channel=False) self.augmentor_op = Operations.RandomBrightness(probability=1, min_factor=1.5, max_factor=1.5) self.solt_stream = slc.Stream( [slt.Brightness(p=1, brightness_range=(127, 127))])
def test_brightness_returns_correct_number_of_channels(img_3x4, img_6x6_rgb): trf = slt.Brightness(p=1, brightness_range=(10, 10)) dc = slc.DataContainer((img_3x4, img_3x4, img_6x6_rgb), "III") dc_res = trf(dc) img1, img2, img3 = dc_res.data assert len(img1.shape) == 3 assert img1.shape[-1] == 1 assert len(img2.shape) == 3 assert img2.shape[-1] == 1 assert len(img3.shape) == 3 assert img3.shape[-1] == 3
def create_train_transforms(size): return solt.Stream([ slt.JPEGCompression(p=0.5,quality_range=(60,100)), slt.Noise(p=0.25), slt.Brightness(), slt.Contrast(), slt.Flip(), slt.Rotate90(), solt.SelectiveStream([ slt.GammaCorrection(gamma_range=0.5, p=1), slt.Noise(gain_range=0.1, p=1), slt.SaltAndPepper(), slt.Blur(), ], n=3), slt.Rotate(angle_range=(-10, 10), p=0.5), slt.Resize((size,size)), ])
def __init__(self): self.imgaug_transform = iaa.Sequential([ iaa.Multiply((1.5, 1.5), per_channel=False), iaa.Add((127, 127), per_channel=False) ]) self.augmentor_pipeline = Pipeline() self.augmentor_pipeline.add_operation( Operations.RandomBrightness(probability=1, min_factor=1.5, max_factor=1.5)) self.augmentor_pipeline.add_operation( Operations.RandomContrast(probability=1, min_factor=1.5, max_factor=1.5)) self.solt_stream = slc.Stream([ slt.Brightness(p=1, brightness_range=(127, 127)), slt.Contrast(p=1, contrast_range=(1.5, 1.5)) ])