              for chan in range(3):
                  image[:, :, chan] = clahe.apply(image[:, :, chan])
          return image
  
      @staticmethod
      def random_lab(image):
          """ Perform random color/lightness adjustment in LAB colorspace """
          randoms = [(random() * 0.6) - 0.3,  # L adjust +/- 30%
                     (random() * 0.16) - 0.08,  # A adjust +/- 8%
                     (random() * 0.16) - 0.08]  # B adjust +/- 8%
  
          logger.trace("Random LAB adjustments: %s", randoms)
          image = cv2.cvtColor(  # pylint:disable=no-member
              image, cv2.COLOR_BGR2LAB).astype("float32") / 255.0  # pylint:disable=no-member
  
 
</s> remove         if contrast_random <= 0.5:
            contrast_adjustment = int((contrast_random * 10.0) * (base_contrast / 2))
            grid_size = base_contrast + contrast_adjustment
            logger.trace("Adjusting Contrast. Grid Size: %s", grid_size)

            clahe = cv2.createCLAHE(clipLimit=2.0,  # pylint: disable=no-member
                                    tileGridSize=(grid_size, grid_size))
            for chan in range(3):
                image[:, :, chan] = clahe.apply(image[:, :, chan])
 </s> add         if contrast_random > self.config.get("color_clahe_chance", 50) / 100:
            return image

        base_contrast = image.shape[0] // 128
        grid_base = random() * self.config.get("color_clahe_max_size", 4)
        contrast_adjustment = int(grid_base * (base_contrast / 2))
        grid_size = base_contrast + contrast_adjustment
        logger.trace("Adjusting Contrast. Grid Size: %s", grid_size)

        clahe = cv2.createCLAHE(clipLimit=2.0,  # pylint: disable=no-member
                                tileGridSize=(grid_size, grid_size))
        for chan in range(3):
            image[:, :, chan] = clahe.apply(image[:, :, chan]) </s> remove         rotation = np.random.uniform(-self.rotation_range, self.rotation_range)
        scale = np.random.uniform(1 - self.zoom_range, 1 + self.zoom_range)
        tnx = np.random.uniform(-self.shift_range, self.shift_range) * width
        tny = np.random.uniform(-self.shift_range, self.shift_range) * height
 </s> add         rotation_range = self.config.get("rotation_range", 10)
        rotation = np.random.uniform(-rotation_range, rotation_range)

        zoom_range = self.config.get("zoom_range", 5) / 100
        scale = np.random.uniform(1 - zoom_range, 1 + zoom_range)

        shift_range = self.config.get("shift_range", 5) / 100
        tnx = np.random.uniform(-shift_range, shift_range) * width
        tny = np.random.uniform(-shift_range, shift_range) * height </s> remove     @staticmethod
    def random_clahe(image):
 </s> add     def random_clahe(self, image): </s> remove         logger.debug("Initializing %s: (input_size: %s, output_size: %s, coverage_ratio: %s)",
                     self.__class__.__name__, input_size, output_size, coverage_ratio)
        # Transform args
        self.rotation_range = 10  # Range to randomly rotate the image by
        self.zoom_range = 0.05  # Range to randomly zoom the image by
        self.shift_range = 0.05  # Range to randomly translate the image by
        self.random_flip = 0.5  # Chance to flip the image horizontally
 </s> add         logger.debug("Initializing %s: (input_size: %s, output_size: %s, coverage_ratio: %s, "
                     "config: %s)", self.__class__.__name__, input_size, output_size,
                     coverage_ratio, config)
        self.config = config </s> remove         if np.random.random() < self.random_flip:
 </s> add         random_flip = self.config.get("random_flip", 50) / 100
        if np.random.random() < random_flip:
    def random_lab(self, image):
        """ Perform random color/lightness adjustment in L*a*b* colorspace """
        amount_l = self.config.get("color_lightness", 30) / 100
        amount_ab = self.config.get("color_ab", 8) / 100

        randoms = [(random() * amount_l * 2) - amount_l,  # L adjust
                   (random() * amount_ab * 2) - amount_ab,  # A adjust
                   (random() * amount_ab * 2) - amount_ab]  # B adjust
              for chan in range(3):
                  image[:, :, chan] = clahe.apply(image[:, :, chan])
          return image
  
    def random_lab(self, image):
        """ Perform random color/lightness adjustment in L*a*b* colorspace """
        amount_l = self.config.get("color_lightness", 30) / 100
        amount_ab = self.config.get("color_ab", 8) / 100

        randoms = [(random() * amount_l * 2) - amount_l,  # L adjust
                   (random() * amount_ab * 2) - amount_ab,  # A adjust
                   (random() * amount_ab * 2) - amount_ab]  # B adjust
    def random_lab(self, image):
        """ Perform random color/lightness adjustment in L*a*b* colorspace """
        amount_l = self.config.get("color_lightness", 30) / 100
        amount_ab = self.config.get("color_ab", 8) / 100

        randoms = [(random() * amount_l * 2) - amount_l,  # L adjust
                   (random() * amount_ab * 2) - amount_ab,  # A adjust
                   (random() * amount_ab * 2) - amount_ab]  # B adjust
    def random_lab(self, image):
        """ Perform random color/lightness adjustment in L*a*b* colorspace """
        amount_l = self.config.get("color_lightness", 30) / 100
        amount_ab = self.config.get("color_ab", 8) / 100

        randoms = [(random() * amount_l * 2) - amount_l,  # L adjust
                   (random() * amount_ab * 2) - amount_ab,  # A adjust
                   (random() * amount_ab * 2) - amount_ab]  # B adjust
    def random_lab(self, image):
        """ Perform random color/lightness adjustment in L*a*b* colorspace """
        amount_l = self.config.get("color_lightness", 30) / 100
        amount_ab = self.config.get("color_ab", 8) / 100

        randoms = [(random() * amount_l * 2) - amount_l,  # L adjust
                   (random() * amount_ab * 2) - amount_ab,  # A adjust
                   (random() * amount_ab * 2) - amount_ab]  # B adjust
    def random_lab(self, image):
        """ Perform random color/lightness adjustment in L*a*b* colorspace """
        amount_l = self.config.get("color_lightness", 30) / 100
        amount_ab = self.config.get("color_ab", 8) / 100

        randoms = [(random() * amount_l * 2) - amount_l,  # L adjust
                   (random() * amount_ab * 2) - amount_ab,  # A adjust
                   (random() * amount_ab * 2) - amount_ab]  # B adjust
    def random_lab(self, image):
        """ Perform random color/lightness adjustment in L*a*b* colorspace """
        amount_l = self.config.get("color_lightness", 30) / 100
        amount_ab = self.config.get("color_ab", 8) / 100

        randoms = [(random() * amount_l * 2) - amount_l,  # L adjust
                   (random() * amount_ab * 2) - amount_ab,  # A adjust
                   (random() * amount_ab * 2) - amount_ab]  # B adjust
  
          logger.trace("Random LAB adjustments: %s", randoms)
          image = cv2.cvtColor(  # pylint:disable=no-member
              image, cv2.COLOR_BGR2LAB).astype("float32") / 255.0  # pylint:disable=no-member
  
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
 Expose Augmentation Options to config 
lib/training_data.py