  
          if not self.verify_output and faces_count > 1:
              self.verify_output = True
  
      def align_face(self, faces, size, filename):
          """ Align the detected face and add the destination file path """
          final_faces = list()
          image = faces["image"]
          detected_faces = faces["detected_faces"]
          for face in detected_faces:
              face.load_aligned(image, size=size)
              final_faces.append({"file_location": self.output_dir / Path(filename).stem,
                                  "face": face})
          faces["detected_faces"] = final_faces
  
      def output_faces(self, filename, faces):
          """ Output faces to save thread """
          final_faces = list()
          for idx, detected_face in enumerate(faces["detected_faces"]):
              output_file = detected_face["file_location"]
              extension = Path(filename).suffix
              out_filename = "{}_{}{}".format(str(output_file), str(idx), extension)
 
</s> remove         for idx, detected_face in enumerate(faces["detected_faces"]):
            output_file = detected_face["file_location"]
            extension = Path(filename).suffix
            out_filename = "{}_{}{}".format(str(output_file), str(idx), extension)

            face = detected_face["face"]
            resized_face = face.aligned_face
            face.hash, img = encode_image_with_hash(resized_face, extension)
            self.save_queue.put((out_filename, img))
 </s> add         filename, extension = os.path.splitext(os.path.basename(faces["filename"]))
        for idx, face in enumerate(faces["detected_faces"]):
            output_filename = "{}_{}{}".format(filename, str(idx), extension)
            face.hash, image = encode_image_with_hash(face.aligned_face, extension)

            saver.save(output_filename, image) </s> remove         if not self.verify_output and faces_count > 1:
            self.verify_output = True
 </s> add         if not self._verify_output and faces_count > 1:
            self._verify_output = True </s> remove             logger.verbose("No faces were detected in image: %s", os.path.basename(filename))
 </s> add             logger.verbose("No faces were detected in image: %s",
                           os.path.basename(faces["filename"])) </s> remove     def output_processing(self, faces, size, filename):
        """ Prepare faces for output """
        self.align_face(faces, size, filename)
        self.post_process.do_actions(faces)
 </s> add     def _output_processing(self, faces, size):
        """ Prepare faces for output

        Loads the aligned face, perform any processing actions and verify the output.

        Parameters:
        faces: dict
            Dictionary output from :class:`plugins.extract.Pipeline.Extractor`
        size: int
            The size that the aligned face should be created at
        """
        for face in faces["detected_faces"]:
            face.load_aligned(faces["image"], size=size)

        self._post_process.do_actions(faces) </s> remove         load_queue = self.extractor.input_queue
        idx = 0
        for filename, image in self.images.load():
            idx += 1
 </s> add         load_queue = self._extractor.input_queue
        for filename, image in self._images.load():
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
  
          if not self.verify_output and faces_count > 1:
              self.verify_output = True
  
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
    def _output_faces(self, saver, faces):
        """ Output faces to save thread

        Set the face filename based on the frame name and put the face to the
        :class:`lib.image.ImagesSaver` save queue and add the face information to the alignments
        data.

        Parameters
        ----------
        saver: lib.images.ImagesSaver
            The background saver for saving the image
        faces: dict
            The output dictionary from :class:`plugins.extract.Pipeline.Extractor`
        """
        logger.debug("Save Faces: Start")
          final_faces = list()
          for idx, detected_face in enumerate(faces["detected_faces"]):
              output_file = detected_face["file_location"]
              extension = Path(filename).suffix
              out_filename = "{}_{}{}".format(str(output_file), str(idx), extension)
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 scripts.extract - code optimizations

Limit queue sizes to reduce RAM usage
Rename lib.image.BackgroundIO to ImageIO
Create separate ImagesLoader and ImagesSaver classes
Load/Save images from centralized lib.image.ImageIO
scripts.extract documentation 
scripts/extract.py