              shift_range,
              size=(self._batchsize, 2)).astype("float32") * self._training_size
  
          mats = np.array(
              [cv2.getRotationMatrix2D((self._training_size // 2, self._training_size // 2),
                                       rot,
                                       scl)
               for rot, scl in zip(rotation, scale)]).astype("float32")
          mats[..., 2] += tform
  
 
</s> remove         tform = np.random.uniform(
            -shift_range,
            shift_range,
            size=(self._batchsize, 2)).astype("float32") * self._training_size
 </s> add  </s> remove         batch = np.array([cv2.warpAffine(image,
                                         mat,
                                         (self._training_size, self._training_size),
                                         borderMode=cv2.BORDER_REPLICATE)
                          for image, mat in zip(batch, mats)])
 </s> add         for image, mat in zip(batch, mats):
            cv2.warpAffine(image,
                           mat,
                           (self._processing_size, self._processing_size),
                           dst=image,
                           borderMode=cv2.BORDER_REPLICATE) </s> remove         scale = np.random.uniform(1 - zoom_range,
                                  1 + zoom_range,
 </s> add         scale = np.random.uniform(1 - self._constants.transform_zoom,
                                  1 + self._constants.transform_zoom, </s> remove         clahe_base_contrast = training_size // 128
        # Target Images
        tgt_slices = slice(self._training_size // 2 - coverage // 2,
                           self._training_size // 2 + coverage // 2)
 </s> add         amount_l = int(self._config.get("color_lightness", 30)) / 100
        amount_ab = int(self._config.get("color_ab", 8)) / 100
        lab_adjust = np.array([amount_l, amount_ab, amount_ab], dtype="float32")
            [cv2.getRotationMatrix2D((self._processing_size // 2, self._processing_size // 2),
              shift_range,
              size=(self._batchsize, 2)).astype("float32") * self._training_size
  
          mats = np.array(
            [cv2.getRotationMatrix2D((self._processing_size // 2, self._processing_size // 2),
                                       rot,
                                       scl)
               for rot, scl in zip(rotation, scale)]).astype("float32")
          mats[..., 2] += tform
  
keep keep keep keep replace keep keep keep keep keep
 Data Augmentation update (#1263)

- lib.detected_face
    - Subclass Masks for Landmark based masks
    - Add training mask propery + methods to DetectedFace
  - lib.training_training
    - subclass TrainingDataGenerator for training and preview data
    - Split cache into own module
    - Reduce thread count to 1 to prevent image corruption + data re-use
    - Process on largest model input/output size rather than stored image size
    - Size and crop masks during caching stage
    - Implement ring buffer for data flow
    - Fix preview reload bug
  - augmentation
    - typing
    - switch color aug order
    - better initialization
    - Fix warp + landmark warp to correctly apply at different image scales
    - Slightly improved warp caching
    - Don't store whether image is_preview. Handle all data as training images implicitly
  - plugins.trainer: Typing and fixes to work with trainingdata refactor 
lib/training/augmentation.py