                      del faces["image"]
                      detected_faces[filename] = faces
                  status_bar.update(1)
  
              if is_final:
                  logger.debug("Putting EOF to save")
                  self.save_queue.put("EOF")
              else:
                  logger.debug("Reloading images")
                  self.threaded_io("reload", detected_faces)
  
      def check_thread_error(self):
          """ Check and raise thread errors """
 
</s> remove                 self.threaded_io("reload", detected_faces)
 </s> add                 self._threaded_redirector("reload", detected_faces)
        saver.close() </s> remove                     detected_faces[filename] = faces
 </s> add  </s> remove     def check_thread_error(self):
        """ Check and raise thread errors """
        for thread in self.threads:
 </s> add     def _check_thread_error(self):
        """ Check if any errors have occurred in the running threads and their errors """
        for thread in self._threads: </s> remove                 if self.extractor.final_pass:
                    self.output_processing(faces, size, filename)
                    self.output_faces(filename, faces)
                    if self.save_interval and (idx + 1) % self.save_interval == 0:
                        self.alignments.save()
 </s> add                 if self._extractor.final_pass:
                    self._output_processing(faces, size)
                    self._output_faces(saver, faces)
                    if self._save_interval and (idx + 1) % self._save_interval == 0:
                        self._alignments.save() </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)
            if not is_final:
                      del faces["image"]
                      detected_faces[filename] = faces
                  status_bar.update(1)
  
            if not is_final:
            if not is_final:
            if not is_final:
            if not is_final:
                  logger.debug("Reloading images")
                  self.threaded_io("reload", detected_faces)
  
      def check_thread_error(self):
          """ Check and raise thread errors """
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