          """ Add a :class:`lib.align.AlignedFace` object to the cache.
  
          Parameters
          ----------
          filename: str
              The file path for the current image
          alignments: dict
              The alignments for a single face, extracted from a PNG header
          image_size: int
              The pixel size of the image loaded from disk
  
          Returns
          -------
          :class:`lib.align.DetectedFace`
              The Detected Face object that was used to create the Aligned Face
 
</s> remove         :class:`lib.align.DetectedFace`
            The Detected Face object that was used to create the Aligned Face
 </s> add         list
            4-dimensional array of faces to feed the training the model.
        list
            List of 4-dimensional :class:`numpy.ndarray`. 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) </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         filename: str
            The file path for the current image
        detected_face: :class:`lib.align.DetectedFace`
            The detected face object that holds the masks
 </s> add         filenames: list
            List of full paths to image file names for a single batch
        images: :class:`numpy.ndarray`
            The batch of faces corresponding to the filenames
        detected_faces: list
            List of :class:`~lib.align.DetectedFace` objects with aligned data and masks loaded for
            the current batch
        batch: :class:`numpy.ndarray`
            The pre-allocated batch with images and masks populated for the selected coverage and
            centering </s> remove         if set_flag:
            logger.warning("You are using legacy extracted faces but have selected '%s' centering "
                           "which is incompatible. Switching centering to 'legacy'",
                           self._centering)
        self._config["centering"] = "legacy"
        self._centering = "legacy"
        self._cache = {key: dict(cached=False) for key in self._cache}
        self._cache_full = False
        self._size = None
        if set_flag:
            self._has_reset = True

    def _add_aligned_face(self, filename, alignments, image_size):
        """ Add a :class:`lib.align.AlignedFace` object to the cache.
 </s> add         if not self._use_mask:
            return

        masks = np.array([face.get_training_masks() for face in detected_faces])
        batch[..., 3:] = masks

        logger.trace("side: %s, masks: %s, batch: %s",  # type: ignore
                     self._side, masks.shape, batch.shape)

    def _process_batch(self, filenames: List[str]) -> BatchType:
        """ Prepares data for feeding through subclassed methods.

        If this is the first time a face has been loaded, then it's meta data is extracted from the
        png header and added to :attr:`_face_cache` </s> remove         Parameters
        ----------
        filename: str
            The file path for the current image
        detected_face: :class:`lib.align.DetectedFace`
            The detected face object that holds the masks
        area: str
            `"eye"` or `"mouth"`. The area of the face to obtain the mask for
 </s> add         in_array: :class:`numpy.ndarray`
            The input uint8 array
        filenames: list
            List of full paths to image file names for a single batch
          """ Add a :class:`lib.align.AlignedFace` object to the cache.
  
          Parameters
          ----------
        filenames: list
            List of full paths to image file names for a single batch
        filenames: list
            List of full paths to image file names for a single batch
        filenames: list
            List of full paths to image file names for a single batch
        filenames: list
            List of full paths to image file names for a single batch
        filenames: list
            List of full paths to image file names for a single batch
        filenames: list
            List of full paths to image file names for a single batch
  
          Returns
          -------
          :class:`lib.align.DetectedFace`
              The Detected Face object that was used to create the Aligned Face
keep keep keep keep 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