                  if exception:
                      break
                  filename = faces["filename"]
  
                  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()
                  else:
                      del faces["image"]
                      detected_faces[filename] = faces
                  status_bar.update(1)
  
 
</s> remove                 filename = faces["filename"]
 </s> add  </s> remove                     detected_faces[filename] = faces
 </s> add  </s> remove             if is_final:
                logger.debug("Putting EOF to save")
                self.save_queue.put("EOF")
            else:
 </s> add             if not is_final: </s> remove                 self.check_thread_error()
 </s> add                 self._check_thread_error() </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
                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()
                  if exception:
                      break
                  filename = faces["filename"]
  
                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()
                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()
                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()
                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()
                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()
                  else:
                      del faces["image"]
                      detected_faces[filename] = faces
                  status_bar.update(1)
  
keep keep keep keep 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