          pad = self._constants["warp_pad"]
          slices = self._constants["warp_slices"]
  
          rands = np.random.normal(size=(self._batchsize, 2, 5, 5),
                                   scale=self._scale).astype("float32")
          batch_maps = np.stack((mapx, mapy), axis=1) + rands
          batch_interp = np.array([[cv2.resize(map_, (pad, pad))[slices, slices] for map_ in maps]
                                   for maps in batch_maps])
          warped_batch = np.array([cv2.remap(image, interp[0], interp[1], cv2.INTER_LINEAR)
                                   for image, interp in zip(batch, batch_interp)])
  
          logger.trace("Warped image shape: %s", warped_batch.shape)
 
</s> remove         logger.trace("Warped image shape: %s", warped_batch.shape)
 </s> add         logger.trace("Warped image shape: %s", warped_batch.shape)  # type: ignore </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 
    def skip_warp(self, batch):
        """ Returns the images resized and cropped for feeding the model, if warping has been
        disabled.

        Parameters
        ----------
        batch: :class:`numpy.ndarray`
            The batch should be a 4-dimensional array of shape (`batchsize`, `height`, `width`,
            `3`) and in `BGR` format.

        Returns
        -------
        :class:`numpy.ndarray`
            The given batch cropped and resized for feeding the model
        """
        logger.trace("Compiling skip warp images: batch shape: %s", batch.shape)
        slices = self._constants["tgt_slices"]
        retval = np.array([cv2.resize(image[slices, slices, :],
                                      (self._input_size, self._input_size),
                                      cv2.INTER_AREA)
                           for image in batch], dtype='float32') / 255.
        logger.trace("feed batch shape: %s", retval.shape)
        return retval
 </s> add  </s> remove                            for src, dst in zip(batch_src, batch_dst)])
 </s> add                            for src, dst in zip(lbatch_src, lbatch_dst)]) </s> remove                                self._training_size,
                               self._training_size,
 </s> add                                self._processing_size,
                               self._processing_size,
                                 scale=self._warp_scale).astype("float32")
        batch_maps = ne.evaluate("m + r", local_dict=dict(m=self._constants.warp_maps, r=rands))
        batch_interp = np.array([[cv2.resize(map_, self._constants.warp_pad)[slices, slices]
                                  for map_ in maps]
          pad = self._constants["warp_pad"]
          slices = self._constants["warp_slices"]
  
          rands = np.random.normal(size=(self._batchsize, 2, 5, 5),
                                 scale=self._warp_scale).astype("float32")
        batch_maps = ne.evaluate("m + r", local_dict=dict(m=self._constants.warp_maps, r=rands))
        batch_interp = np.array([[cv2.resize(map_, self._constants.warp_pad)[slices, slices]
                                  for map_ in maps]
                                 scale=self._warp_scale).astype("float32")
        batch_maps = ne.evaluate("m + r", local_dict=dict(m=self._constants.warp_maps, r=rands))
        batch_interp = np.array([[cv2.resize(map_, self._constants.warp_pad)[slices, slices]
                                  for map_ in maps]
                                 scale=self._warp_scale).astype("float32")
        batch_maps = ne.evaluate("m + r", local_dict=dict(m=self._constants.warp_maps, r=rands))
        batch_interp = np.array([[cv2.resize(map_, self._constants.warp_pad)[slices, slices]
                                  for map_ in maps]
                                   for maps in batch_maps])
          warped_batch = np.array([cv2.remap(image, interp[0], interp[1], cv2.INTER_LINEAR)
                                   for image, interp in zip(batch, batch_interp)])
  
          logger.trace("Warped image shape: %s", warped_batch.shape)
keep keep keep keep 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