def __init__(self): self.imgaug_transform = iaa.Multiply((1.5, 1.5), per_channel=False) self.augmentor_op = Operations.RandomContrast(probability=1, min_factor=1.5, max_factor=1.5) self.solt_stream = slc.Stream( [slt.Contrast(p=1, contrast_range=(1.5, 1.5))])
def test_random_contrast_multiplies_the_data(img): dc = slc.DataContainer((img, ), "I") ppl = slt.Contrast(p=1, contrast_range=(2, 2)) dc_res = ppl(dc) assert np.array_equal(dc.data[0] * 2, dc_res.data[0])
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)) ])
def test_lut_transforms_raise_errors(value_range, to_catch): with pytest.raises(to_catch): slt.GammaCorrection(gamma_range=value_range) with pytest.raises(to_catch): slt.Contrast(contrast_range=value_range)