(brightness, contrast, saturation, hue)
return transform
Get a randomized transform to be applied on image.

        Arguments are same as that of __init__.

        Returns:
            Transform which randomly adjusts brightness, contrast and
            saturation in a random order.
Get a randomized transform to be applied on image.
Get a randomized transform to be applied on image .
def get_params(brightness, contrast, saturation, hue):
        """Get a randomized transform to be applied on image.

        Arguments are same as that of __init__.

        Returns:
            Transform which randomly adjusts brightness, contrast and
            saturation in a random order.
        """
        transforms = []
        if brightness > 0:
            brightness_factor = np.random.uniform(max(0, 1 - brightness), 1 + brightness)
            transforms.append(Lambda(lambda img: adjust_brightness(img, brightness_factor)))

        if contrast > 0:
            contrast_factor = np.random.uniform(max(0, 1 - contrast), 1 + contrast)
            transforms.append(Lambda(lambda img: adjust_contrast(img, contrast_factor)))

        if saturation > 0:
            saturation_factor = np.random.uniform(max(0, 1 - saturation), 1 + saturation)
            transforms.append(Lambda(lambda img: adjust_saturation(img, saturation_factor)))

        if hue > 0:
            hue_factor = np.random.uniform(-hue, hue)
            transforms.append(Lambda(lambda img: adjust_hue(img, hue_factor)))

        np.random.shuffle(transforms)
        transform = Compose(transforms)

        return transform
def get_params ( brightness , contrast , saturation , hue ) : transforms = [ ] if brightness > 0 : brightness_factor = np . random . uniform ( max ( 0 , 1 - brightness ) , 1 + brightness ) transforms . append ( Lambda ( lambda img : adjust_brightness ( img , brightness_factor ) ) ) if contrast > 0 : contrast_factor = np . random . uniform ( max ( 0 , 1 - contrast ) , 1 + contrast ) transforms . append ( Lambda ( lambda img : adjust_contrast ( img , contrast_factor ) ) ) if saturation > 0 : saturation_factor = np . random . uniform ( max ( 0 , 1 - saturation ) , 1 + saturation ) transforms . append ( Lambda ( lambda img : adjust_saturation ( img , saturation_factor ) ) ) if hue > 0 : hue_factor = np . random . uniform ( - hue , hue ) transforms . append ( Lambda ( lambda img : adjust_hue ( img , hue_factor ) ) ) np . random . shuffle ( transforms ) transform = Compose ( transforms ) return transform