  
      def reload_images(self, detected_faces):
          """ Reload the images and pair to detected face """
          logger.debug("Reload Images: Start. Detected Faces Count: %s", len(detected_faces))
          load_queue = self.extractor.input_queue
          idx = 0
          for filename, image in self.images.load():
              idx += 1
              if load_queue.shutdown.is_set():
                  logger.debug("Reload Queue: Stop signal received. Terminating")
                  break
              if idx % self.skip_num != 0:
                  logger.trace("Skipping image '%s' due to extract_every_n = %s",
 
</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(): </s> remove             if idx % self.skip_num != 0:
                logger.trace("Skipping image '%s' due to extract_every_n = %s",
                             filename, self.skip_num)
                continue
 </s> add  </s> remove     def reload_images(self, detected_faces):
        """ Reload the images and pair to detected face """
 </s> add     def _reload(self, detected_faces):
        """ Reload the images and pair to detected face

        When the extraction pipeline is running in serial mode, images are reloaded from disk,
        paired with their extraction data and passed back into the extraction queue

        Parameters
        ----------
        detected_faces: dict
            Dictionary of detected_faces with the filename as its key and a list of
            :class:`lib.faces_detect.DetectedFace` as the values for pairing with reloaded images.
        """ </s> remove             if idx % self.skip_num != 0:
                logger.trace("Skipping image '%s' due to extract_every_n = %s",
                             filename, self.skip_num)
                continue
            if image is None or (not image.any() and image.ndim not in ((2, 3))):
                # All black frames will return not np.any() so check dims too
                logger.warning("Unable to open image. Skipping: '%s'", filename)
                continue
            imagename = os.path.basename(filename)
            if imagename in self.alignments.data.keys():
                logger.trace("Skipping image: '%s'", filename)
                continue
 </s> add  </s> remove     def load_images(self):
        """ Load the images """
 </s> add         Loads images from :class:`lib.image.ImagesLoader`, formats them into a dict compatible
        with :class:`plugins.extract.Pipeline.Extractor` and passes them into the extraction queue.
        """
        load_queue = self._extractor.input_queue
        for filename, image in self._images.load():
  
      def reload_images(self, detected_faces):
          """ Reload the images and pair to detected face """
          logger.debug("Reload Images: Start. Detected Faces Count: %s", len(detected_faces))
        load_queue = self._extractor.input_queue
        for filename, image in self._images.load():
        load_queue = self._extractor.input_queue
        for filename, image in self._images.load():
        load_queue = self._extractor.input_queue
        for filename, image in self._images.load():
        load_queue = self._extractor.input_queue
        for filename, image in self._images.load():
              if load_queue.shutdown.is_set():
                  logger.debug("Reload Queue: Stop signal received. Terminating")
                  break
              if idx % self.skip_num != 0:
                  logger.trace("Skipping image '%s' due to extract_every_n = %s",
keep keep keep keep 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