          if self._augment_color:
              batch[..., :3] = self._processing.color_adjust(batch[..., :3])
  
          # Random Transform and flip
          batch = self._processing.transform(batch)
          if not self._no_flip:
              batch = self._processing.random_flip(batch)
  
          # Switch color order for RGB models
          if self._color_order == "rgb":
 
</s> remove             batch = self._processing.random_flip(batch)
 </s> add             self._processing.random_flip(batch) </s> remove         if self._color_order == "rgb":
            batch[..., :3] = batch[..., [2, 1, 0]]

        # Add samples to output if this is for display
        if self._processing.is_display:
            processed["samples"] = batch[..., :3].astype("float32") / 255.0
 </s> add         self._set_color_order(batch) </s> remove         full, faces = samples[:2]
 </s> add         faces, full = samples[:2] </s> remove         logger.trace("Caching mask for: %s", filename)
        self._cache[key]["mask"] = mask
 </s> add         batch: :class:`numpy.ndarray`
            The pre-allocated batch with images in the first 3 channels in BGR order
        """
        if self._color_order == "rgb":
            batch[..., :3] = batch[..., [2, 1, 0]] </s> remove         # Get Landmarks prior to manipulating the image
        if self._warp_to_landmarks:
            batch_dst_pts = self._get_closest_match(filenames, side, landmarks)
            warp_kwargs = dict(batch_src_points=landmarks, batch_dst_points=batch_dst_pts)
        else:
            warp_kwargs = dict()
 </s> add         Returns
        -------
        feed: list
            4-dimensional array of faces to feed the training the model (:attr:`x` parameter for
            :func:`keras.models.model.train_on_batch`.). The array returned is in the format
            (`batch size`, `height`, `width`, `channels`).
        targets: list
            List of 4-dimensional :class:`numpy.ndarray` objects in the order and size of each
            output of the model. The format of these arrays will be (`batch size`, `height`,
            `width`, `x`). This is the :attr:`y` parameter for
            :func:`keras.models.model.train_on_batch`. The number of channels here will vary.
            The first 3 channels are (rgb/bgr). The 4th channel is the face mask. Any subsequent
            channels are area masks (e.g. eye/mouth masks)
        """
        logger.trace("Process training: (side: '%s', filenames: '%s', images: %s, "  # type:ignore
                     "batch: %s, detected_faces: %s)", self._side, filenames, images.shape,
                     batch.shape, len(detected_faces))
        self._processing.transform(batch)

          if self._augment_color:
              batch[..., :3] = self._processing.color_adjust(batch[..., :3])
  
          # Random Transform and flip
        self._processing.transform(batch)

          if not self._no_flip:
              batch = self._processing.random_flip(batch)
  
          # Switch color order for RGB models
          if self._color_order == "rgb":
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/generator.py