                         "alignments file to generate this data.")
                  raise FaceswapError(msg)
              alignments = metadata["alignments"]
              aligned_face = AlignedFace(np.array(alignments["landmarks_xy"], dtype="float32"),
                                         image=image,
                                         centering="legacy",
                                         is_aligned=True)
              filenames.append(filename)
              yaws.append(aligned_face.pose.yaw)
  
 
</s> remove             alignments = metadata["alignments"]
 </s> add             alignments = metadata["itxt"]["alignments"] </s> remove         for filename, image, metadata in tqdm(self._loader.load(),
                                              desc="Classifying Faces",
                                              total=self._loader.count,
                                              leave=False):
 </s> add         filelist = [os.path.join(self._loader.location, fname)
                    for fname in os.listdir(self._loader.location)
                    if os.path.splitext(fname)[-1] == ".png"]
        for filename, metadata in tqdm(read_image_meta_batch(filelist),
                                       total=len(filelist),
                                       desc="Calculating Yaw"): </s> remove class Sort():
 </s> add class Sort():  # pylint:disable=too-few-public-methods
    """ Sorts folders of faces based on input criteria

    Wrapper for the sort process to run in either batch mode or single use mode

    Parameters
    ----------
    arguments: :class:`argparse.Namespace`
        The arguments to be passed to the extraction process as generated from Faceswap's command
        line arguments
    """
    def __init__(self, arguments: Namespace) -> None:
        self._args = arguments
        self._input_locations = self._get_input_locations()

    def _get_input_locations(self) -> List[str]:
        """ Obtain the full path to input locations. Will be a list of locations if batch mode is
        selected, or a containing a single location if batch mode is not selected.

        Returns
        -------
        list:
            The list of input location paths
        """
        if not self._args.batch_mode:
            return [self._args.input_dir]

        retval = [os.path.join(self._args.input_dir, fname)
                  for fname in os.listdir(self._args.input_dir)
                  if os.path.isdir(os.path.join(self._args.input_dir, fname))]
        logger.info("Input locations: %s", retval)
        return retval

    def _output_for_input(self, input_location: str) -> str:
        """ Obtain the path to an output folder for faces for a given input location.

        If not running in batch mode, then the user supplied output location will be returned,
        otherwise a sub-folder within the user supplied output location will be returned based on
        the input filename

        Parameters
        ----------
        input_location: str
            The full path to an input video or folder of images
        """
        if not self._args.batch_mode or self._args.output_dir is None:
            return self._args.output_dir

        retval = os.path.join(self._args.output_dir, os.path.basename(input_location))
        logger.info("Returning output: '%s' for input: '%s'", retval, input_location)
        return retval

    def process(self) -> None:
        """ The entry point for triggering the Sort Process.

        Should only be called from  :class:`lib.cli.launcher.ScriptExecutor`
        """
        logger.info('Starting, this may take a while...')
        inputs = self._input_locations
        if self._args.batch_mode:
            logger.info("Batch mode selected processing: %s", self._input_locations)
        for job_no, location in enumerate(self._input_locations):
            if self._args.batch_mode:
                logger.info("Processing job %s of %s: '%s'", job_no + 1, len(inputs), location)
                arguments = Namespace(**self._args.__dict__)
                arguments.input_dir = location
                arguments.output_dir = self._output_for_input(location)
            else:
                arguments = self._args
            sort = _Sort(arguments)
            sort.process()


class _Sort(): </s> remove logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
 </s> add logger = logging.getLogger(__name__) </s> remove #: tools/sort/cli.py:52
 </s> add #: tools/sort/cli.py:62
                                       image=None,
                         "alignments file to generate this data.")
                  raise FaceswapError(msg)
              alignments = metadata["alignments"]
              aligned_face = AlignedFace(np.array(alignments["landmarks_xy"], dtype="float32"),
                                       image=None,
                                         centering="legacy",
                                         is_aligned=True)
              filenames.append(filename)
              yaws.append(aligned_face.pose.yaw)
  
keep keep keep keep replace keep keep keep keep keep
 Sort - Add Batch Mode. Speed up yaw sort 
tools/sort/sort.py