              return
          skip_list = []
          for idx, filename in enumerate(self._images.file_list):
              if idx % self._skip_num != 0:
                  logger.trace("Adding image '%s' to skip list due to extract_every_n = %s",
                               filename, self._skip_num)
                  skip_list.append(idx)
              # Items may be in the alignments file if skip-existing[-faces] is selected
              elif os.path.basename(filename) in self._alignments.data:
                  self._existing_count += 1
                  logger.trace("Removing image: '%s' due to previously existing", filename)
 
</s> remove                 logger.trace("Removing image: '%s' due to previously existing", filename)
 </s> add                 logger.trace("Removing image: '%s' due to previously existing",  # type: ignore
                             filename) </s> remove         Returns
        -------
        bool
            ``True`` if the cache has been reset because of a face centering change due to
            legacy alignments, otherwise ``False``. """
        retval = self._has_reset
        if retval:
            logger.debug("Resetting 'has_reset' flag")
            self._has_reset = False
        return retval
 </s> add         Raises
        ------
        :class:`FaceswapError`
            If the number of images loaded is smaller than the selected batch size
        """
        length = len(self._images)
        msg = ("Number of images is lower than batch-size (Note that too few images may lead to "
               f"bad training). # images: {length}, batch-size: {self._batch_size}")
        try:
            assert length >= self._batch_size, msg
        except AssertionError as err:
            msg += ("\nYou should increase the number of images in your training set or lower "
                    "your batch-size.")
            raise FaceswapError(msg) from err </s> remove                                   raise_error=True, with_metadata=with_metadata): filename
                  for filename in filenames}
        batch = [None for _ in range(len(filenames))]
        if with_metadata:
            meta = [None for _ in range(len(filenames))]
        # There is no guarantee that the same filename will not be passed through multiple times
        # (and when shuffle is true this can definitely happen), so we can't just call
        # filenames.index().
        return_indices = {filename: [idx for idx, fname in enumerate(filenames)
                                     if fname == filename]
                          for filename in set(filenames)}
 </s> add                                   raise_error=True, with_metadata=with_metadata): idx
                  for idx, filename in enumerate(filenames)} </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     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.
                logger.trace("Adding image '%s' to skip list due to "  # type: ignore
                             "extract_every_n = %s", filename, self._skip_num)
              return
          skip_list = []
          for idx, filename in enumerate(self._images.file_list):
              if idx % self._skip_num != 0:
                logger.trace("Adding image '%s' to skip list due to "  # type: ignore
                             "extract_every_n = %s", filename, self._skip_num)
                logger.trace("Adding image '%s' to skip list due to "  # type: ignore
                             "extract_every_n = %s", filename, self._skip_num)
                  skip_list.append(idx)
              # Items may be in the alignments file if skip-existing[-faces] is selected
              elif os.path.basename(filename) in self._alignments.data:
                  self._existing_count += 1
                  logger.trace("Removing image: '%s' due to previously existing", filename)
keep keep keep keep 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 
scripts/extract.py