  
          detected_face = DetectedFace()
          detected_face.from_png_meta(alignments)
  
          aligned_face = AlignedFace(detected_face.landmarks_xy,
                                     centering=self._centering,
                                     size=self._size,
                                     is_aligned=True)
          logger.trace("Caching aligned face for: %s", filename)
          self._cache[os.path.basename(filename)]["aligned_face"] = aligned_face
          return detected_face
  
      def _add_mask(self, filename, detected_face):
          """ Load the mask to the cache if a mask is required for training.
  
          Parameters
 
</s> remove     def _add_mask(self, filename, detected_face):
        """ Load the mask to the cache if a mask is required for training.
 </s> add     def process_batch(self,
                      filenames: List[str],
                      images: np.ndarray,
                      detected_faces: List[DetectedFace],
                      batch: np.ndarray) -> BatchType:
        """ Override for processing the batch for the current generator. </s> remove         if self._size is None:
            self._size = get_centered_size("legacy" if self._extract_version == 1.0 else "head",
                                           self._centering,
                                           image_size)

        detected_face = DetectedFace()
        detected_face.from_png_meta(alignments)
 </s> add         raw_faces, detected_faces = self._get_images_with_meta(filenames)
        batch = self._buffer()
        self._crop_to_coverage(filenames, raw_faces, detected_faces, batch)
        self._apply_mask(detected_faces, batch) </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     def _add_localized_mask(self, filename, detected_face, area):
        """ Load a localized mask to the cache for the given area if it is required for training.
 </s> add     def _to_float32(self, in_array: np.ndarray) -> np.ndarray:
        """ Cast an UINT8 array in 0-255 range to float32 in 0.0-1.0 range. </s> remove         pose = self._cache[key]["aligned_face"].pose
        mask.set_sub_crop(pose.offset[mask.stored_centering],
                          pose.offset[self._centering],
                          self._centering)
 </s> add     def _set_color_order(self, batch) -> None:
        """ Set the color order correctly for the model's input type.
        return self.process_batch(filenames, raw_faces, detected_faces, batch)
  
          detected_face = DetectedFace()
          detected_face.from_png_meta(alignments)
  
        return self.process_batch(filenames, raw_faces, detected_faces, batch)
        return self.process_batch(filenames, raw_faces, detected_faces, batch)
        return self.process_batch(filenames, raw_faces, detected_faces, batch)
        return self.process_batch(filenames, raw_faces, detected_faces, batch)
        return self.process_batch(filenames, raw_faces, detected_faces, batch)
        return self.process_batch(filenames, raw_faces, detected_faces, batch)
        return self.process_batch(filenames, raw_faces, detected_faces, batch)
  
      def _add_mask(self, filename, detected_face):
          """ Load the mask to the cache if a mask is required for training.
  
          Parameters
keep keep keep keep replace replace 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/generator.py