          pbar = tqdm(desc="Reading training images",
                      total=sum(len(val) for val in image_list.values()))
          for side, filelist in image_list.items():
              logger.debug("side: %s, file count: %s", side, len(filelist))
              for filename, hsh in read_image_hash_batch(filelist):
                  hashes[side]["hashes"].append(hsh)
                  hashes[side]["filenames"].append(filename)
                  pbar.update(1)
          pbar.close()
          logger.trace(hashes)
          return hashes
  
      def _load_alignments(self):
          """ Load the alignments and convert to :class:`lib.faces_detect.DetectedFace` objects.
 
</s> remove         hashes = {key: dict(hashes=[], filenames=[]) for key in image_list}
        pbar = tqdm(desc="Reading training images",
                    total=sum(len(val) for val in image_list.values()))
 </s> add         hashes = {key: dict() for key in image_list} </s> remove             For keys "a" and "b" the values are a ``dict`` containing keys "hashes" and "filenames"
            with their values being a list of hashes and filenames that exist within the training
            data folder
 </s> add             For keys "a" and "b" the values are a ``dict`` with the key being the sha1 hash and
            the value being a list of filenames that correspond to the hash for images that exist
            within the training data folder </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         side_hashes = self._hashes[side]
        hash_indices = [idx for idx, hsh in enumerate(side_hashes["hashes"]) if hsh == face_hash]
        retval = [side_hashes["filenames"][idx] for idx in hash_indices]
 </s> add         retval = self._hashes[side][face_hash]
            for filename, hsh in tqdm(read_image_hash_batch(filelist),
                                      desc="Reading training images ({})".format(side.upper()),
                                      total=len(filelist),
                                      leave=False):
                hashes[side].setdefault(hsh, list()).append(filename)
          pbar = tqdm(desc="Reading training images",
                      total=sum(len(val) for val in image_list.values()))
          for side, filelist in image_list.items():
              logger.debug("side: %s, file count: %s", side, len(filelist))
            for filename, hsh in tqdm(read_image_hash_batch(filelist),
                                      desc="Reading training images ({})".format(side.upper()),
                                      total=len(filelist),
                                      leave=False):
                hashes[side].setdefault(hsh, list()).append(filename)
            for filename, hsh in tqdm(read_image_hash_batch(filelist),
                                      desc="Reading training images ({})".format(side.upper()),
                                      total=len(filelist),
                                      leave=False):
                hashes[side].setdefault(hsh, list()).append(filename)
            for filename, hsh in tqdm(read_image_hash_batch(filelist),
                                      desc="Reading training images ({})".format(side.upper()),
                                      total=len(filelist),
                                      leave=False):
                hashes[side].setdefault(hsh, list()).append(filename)
            for filename, hsh in tqdm(read_image_hash_batch(filelist),
                                      desc="Reading training images ({})".format(side.upper()),
                                      total=len(filelist),
                                      leave=False):
                hashes[side].setdefault(hsh, list()).append(filename)
            for filename, hsh in tqdm(read_image_hash_batch(filelist),
                                      desc="Reading training images ({})".format(side.upper()),
                                      total=len(filelist),
                                      leave=False):
                hashes[side].setdefault(hsh, list()).append(filename)
          logger.trace(hashes)
          return hashes
  
      def _load_alignments(self):
          """ Load the alignments and convert to :class:`lib.faces_detect.DetectedFace` objects.
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
 plugins.train.trainer - Speed up mask caching 
plugins/train/trainer/_base.py