              count = idx
              resized_image = self.extractor.extract(image, face, 256)
              output_file = get_folder(self.output_dir) / Path(filename).stem
              cv2.imwrite(str(output_file) + str(idx) + Path(filename).suffix, resized_image)
          return count + 1
  
 
</s> remove         for idx, face in self.get_faces(image):
 </s> add         faces = self.get_faces(image)
        rvals = []
        for idx, face in faces: </s> remove             self.faces_detected = self.faces_detected + 1
 </s> add             self.num_faces_detected += 1 </s> remove         if processes != 1:
            files = list(self.read_directory())
            for _ in tqdm(pool_process(self.processFiles, files, processes=processes), total = len(files)):
                self.faces_detected +=1
        else:
            try:
                for filename in tqdm(self.read_directory()):
                    self.handleImage(filename)

            except Exception as e:
                print('Failed to extract from image: {}. Reason: {}'.format(filename, e))
 </s> add         try:
            if processes != 1:
                files = list(self.read_directory())
                for fn, faces in tqdm(pool_process(self.processFiles, files, processes=processes), total = len(files)):
                    self.num_faces_detected += 1
                    self.faces_detected[fn] = faces
            else:
                try:
                    for filename in tqdm(self.read_directory()):
                         self.faces_detected[filename] = self.handleImage(filename)[1]
                except Exception as e:
                    print('Failed to extract from image: {}. Reason: {}'.format(filename, e))
        finally:
            self.write_alignments() </s> remove     
 </s> add         self.landmarksXY = landmarksXY

            f = {
                "x": face.x,
                "w": face.w,
                "y": face.y,
                "h": face.h,
                "landmarksXY": face.landmarksAsXY()
            }
            rvals.append(f)
        return filename, rvals
              count = idx
              resized_image = self.extractor.extract(image, face, 256)
              output_file = get_folder(self.output_dir) / Path(filename).stem
              cv2.imwrite(str(output_file) + str(idx) + Path(filename).suffix, resized_image)
            f = {
                "x": face.x,
                "w": face.w,
                "y": face.y,
                "h": face.h,
                "landmarksXY": face.landmarksAsXY()
            }
            rvals.append(f)
        return filename, rvals
            f = {
                "x": face.x,
                "w": face.w,
                "y": face.y,
                "h": face.h,
                "landmarksXY": face.landmarksAsXY()
            }
            rvals.append(f)
        return filename, rvals
keep keep keep keep replace replace
 Added serializers.

This speeds up convert speed x4 on my machine. 
scripts/extract.py