              if alignment_version == 1.0 and self._centering != "legacy":
                  self._reset_cache(True)
              return
  
          if (self._extract_version == 1.0 and alignment_version > 1.0) or (
                  alignment_version == 1.0 and self._extract_version > 1.0):
              raise FaceswapError("Mixing legacy and full head extracted facesets is not supported. "
                                  "The following folder contains a mix of extracted face types: "
                                  "{}".format(os.path.dirname(filename)))
  
          self._extract_version = min(alignment_version, self._extract_version)
  
      def _reset_cache(self, set_flag):
          """ In the event that a legacy extracted face has been seen, and centering is not legacy
 
</s> remove         Raises
        ------
        FaceswapError
            If a version 1.0 face appears in a 2.x set or vice versa
        """
        alignment_version = png_meta["source"]["alignments_version"]

        if not self._extract_version:
            logger.debug("Setting initial extract version: %s", alignment_version)
            self._extract_version = alignment_version
            if alignment_version == 1.0 and self._centering != "legacy":
                self._reset_cache(True)
            return
 </s> add             for future in futures.as_completed(proc):
                batch[proc[future], ..., :3] = future.result() </s> remove         self._extract_version = min(alignment_version, self._extract_version)
 </s> add         If the configuration options `eye_multiplier` and/or `mouth_multiplier` are greater than 1
        then these masks are applied to the final channels of the batch respectively. </s> remove     def _reset_cache(self, set_flag):
        """ In the event that a legacy extracted face has been seen, and centering is not legacy
        the cache will need to be reset for legacy centering.
 </s> add         If masks are not being used then this function returns having done nothing </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         set_flag: bool
            ``True`` if the flag should be set to indicate that the cache is being reset because of
            a legacy face set/centering mismatch. ``False`` if the cache is being reset because it
            has detected a reset flag from the opposite cache.
 </s> add         detected_face: list
            The list of :class:`~lib.align.DetectedFace` objects corresponding to the batch
        batch: :class:`numpy.ndarray`
            The preallocated array to apply masks to
        side: str
            '"a"' or '"b"' the side that is being processed
    def _apply_mask(self, detected_faces: List[DetectedFace], batch: np.ndarray) -> None:
        """ Applies the masks to the 4th channel of the batch.
              if alignment_version == 1.0 and self._centering != "legacy":
                  self._reset_cache(True)
              return
  
    def _apply_mask(self, detected_faces: List[DetectedFace], batch: np.ndarray) -> None:
        """ Applies the masks to the 4th channel of the batch.
    def _apply_mask(self, detected_faces: List[DetectedFace], batch: np.ndarray) -> None:
        """ Applies the masks to the 4th channel of the batch.
    def _apply_mask(self, detected_faces: List[DetectedFace], batch: np.ndarray) -> None:
        """ Applies the masks to the 4th channel of the batch.
    def _apply_mask(self, detected_faces: List[DetectedFace], batch: np.ndarray) -> None:
        """ Applies the masks to the 4th channel of the batch.
    def _apply_mask(self, detected_faces: List[DetectedFace], batch: np.ndarray) -> None:
        """ Applies the masks to the 4th channel of the batch.
  
          self._extract_version = min(alignment_version, self._extract_version)
  
      def _reset_cache(self, set_flag):
          """ In the event that a legacy extracted face has been seen, and centering is not legacy
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/generator.py