                                       scl)
               for rot, scl in zip(rotation, scale)]).astype("float32")
          mats[..., 2] += tform
  
          batch = np.array([cv2.warpAffine(image,
                                           mat,
                                           (self._training_size, self._training_size),
                                           borderMode=cv2.BORDER_REPLICATE)
                            for image, mat in zip(batch, mats)])
  
          logger.trace("Randomly transformed image")
          return batch
  
      def random_flip(self, batch):
 
</s> remove         logger.trace("Randomly transformed image")
        return batch
 </s> add         logger.trace("Randomly transformed image")  # type: ignore </s> remove             [cv2.getRotationMatrix2D((self._training_size // 2, self._training_size // 2),
 </s> add             [cv2.getRotationMatrix2D((self._processing_size // 2, self._processing_size // 2), </s> remove     def random_flip(self, batch):
 </s> add     def random_flip(self, batch: np.ndarray): </s> remove         warped_batch = np.array([cv2.resize(image[slices, slices, :],
                                            (self._input_size, self._input_size),
                                            cv2.INTER_AREA)
                                 for image in warped_batch])
        logger.trace("Warped batch shape: %s", warped_batch.shape)
 </s> add         logger.trace("Warped batch shape: %s", warped_batch.shape)  # type: ignore </s> remove         logger.trace("Warped image shape: %s", warped_batch.shape)
 </s> add         logger.trace("Warped image shape: %s", warped_batch.shape)  # type: ignore
        for image, mat in zip(batch, mats):
            cv2.warpAffine(image,
                           mat,
                           (self._processing_size, self._processing_size),
                           dst=image,
                           borderMode=cv2.BORDER_REPLICATE)
                                       scl)
               for rot, scl in zip(rotation, scale)]).astype("float32")
          mats[..., 2] += tform
  
        for image, mat in zip(batch, mats):
            cv2.warpAffine(image,
                           mat,
                           (self._processing_size, self._processing_size),
                           dst=image,
                           borderMode=cv2.BORDER_REPLICATE)
        for image, mat in zip(batch, mats):
            cv2.warpAffine(image,
                           mat,
                           (self._processing_size, self._processing_size),
                           dst=image,
                           borderMode=cv2.BORDER_REPLICATE)
        for image, mat in zip(batch, mats):
            cv2.warpAffine(image,
                           mat,
                           (self._processing_size, self._processing_size),
                           dst=image,
                           borderMode=cv2.BORDER_REPLICATE)
        for image, mat in zip(batch, mats):
            cv2.warpAffine(image,
                           mat,
                           (self._processing_size, self._processing_size),
                           dst=image,
                           borderMode=cv2.BORDER_REPLICATE)
        for image, mat in zip(batch, mats):
            cv2.warpAffine(image,
                           mat,
                           (self._processing_size, self._processing_size),
                           dst=image,
                           borderMode=cv2.BORDER_REPLICATE)
  
          logger.trace("Randomly transformed image")
          return batch
  
      def random_flip(self, batch):
keep keep keep keep replace replace replace replace 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