                  logger.error("Faces missing alignments for side %s: %s",
                               side.capitalize(), filelist)
              raise FaceswapError(msg)
  
      # Get landmarks
      def _transform_landmarks(self, side, detected_faces):
          """ Transform frame landmarks to their aligned face variant.
  
          Parameters
          ----------
          side: {"a" or "b"}
              The side currently being processed
          detected_faces: list
              A list of :class:`lib.faces_detect.DetectedFace` objects
  
          Returns
          -------
          dict
              The face filenames as keys with the aligned landmarks as value.
          """
          landmarks = dict()
          for face in detected_faces:
              face.load_aligned(None, size=self._training_opts["training_size"])
              for filename in self._hash_to_filenames(side, face.hash):
                  landmarks[filename] = face.aligned_landmarks
          return landmarks
  
      # Get masks
      def _get_masks(self, side, detected_faces):
          """ For each face, obtain the mask and set the requested blurring and threshold level.
  
          Parameters
          ----------
          side: {"a" or "b"}
              The side currently being processed
          detected_faces: list
              A list of :class:`lib.faces_detect.DetectedFace` objects
  
          Returns
          -------
          dict
              The face filenames as keys with the :class:`lib.faces_detect.Mask` as value.
          """
  
          masks = dict()
          for face in detected_faces:
              mask = face.mask[self._training_opts["mask_type"]]
              mask.set_blur_kernel_and_threshold(blur_kernel=self._training_opts["mask_blur_kernel"],
                                                 threshold=self._training_opts["mask_threshold"])
              for filename in self._hash_to_filenames(side, face.hash):
                  masks[filename] = mask
          return masks
  
      def _hash_to_filenames(self, side, face_hash):
          """ For a given hash return all the filenames that match for the given side.
  
          Notes
          -----
 
</s> remove     # Load alignments
 </s> add     def _get_masks(self, side, detected_faces):
        """ For each face, obtain the mask and set the requested blurring and threshold level.

        Parameters
        ----------
        side: {"a" or "b"}
            The side currently being processed
        detected_faces: dict
            Key is the hash of the face, value is the corresponding
            :class:`lib.faces_detect.DetectedFace` object

        Returns
        -------
        dict
            The face filenames as keys with the :class:`lib.faces_detect.Mask` as value.
        """

        masks = dict()
        for fhash, face in detected_faces.items():
            mask = face.mask[self._training_opts["mask_type"]]
            mask.set_blur_kernel_and_threshold(blur_kernel=self._training_opts["mask_blur_kernel"],
                                               threshold=self._training_opts["mask_threshold"])
            for filename in self._hash_to_filenames(side, fhash):
                masks[filename] = mask
        return masks

    # Pre flight checks
    def _check_alignments_exist(self):
        """ Ensure the alignments files exist prior to running any longer running tasks.

        Raises
        ------
        FaceswapError
            If at least one alignments file does not exist
        """
        for fullpath in self._training_opts["alignments"].values():
            if not os.path.exists(fullpath):
                raise FaceswapError("Alignments file does not exist: `{}`".format(fullpath))

    # Hashes for image folders </s> remove         list
            List of :class:`lib.faces_detect.DetectedFace` objects
 </s> add         dict
            key is sha1 hash of face, value is the corresponding
            :class:`lib.faces_detect.DetectedFace` object </s> remove             For keys "a" and "b" values are a list of :class:`lib.faces_detect.DetectedFace`
            objects.
 </s> add             For keys "a" and "b" values are a dict with the key being the sha1 hash of the face
            and the value being the corresponding :class:`lib.faces_detect.DetectedFace` object.
    # Utils
                  logger.error("Faces missing alignments for side %s: %s",
                               side.capitalize(), filelist)
              raise FaceswapError(msg)
  
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
    # Utils
      def _hash_to_filenames(self, side, face_hash):
          """ For a given hash return all the filenames that match for the given side.
  
          Notes
          -----
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 plugins.train.trainer - Speed up mask caching 
plugins/train/trainer/_base.py