      rotation_matrix = cv2.invertAffineTransform(rotation_matrix)
      rotated = list()
      for item in (bounding_box, landmarks):
          points = np.array(item, np.int32)
          points = np.expand_dims(points, axis=0)
          transformed = cv2.transform(points,
                                      rotation_matrix).astype(np.int32)
          rotated.append(transformed.squeeze())
 
</s> remove     bounding_box = [[face.x, face.y],
                    [face.x + face.w, face.y],
                    [face.x + face.w, face.y + face.h],
                    [face.x, face.y + face.h]]
    landmarks = face.landmarksXY
 </s> add  </s> remove         Pass in a DetectedFace object"""
 </s> add         Pass in a DetectedFace object, Alignments dict or DLib rectangle"""
    if isinstance(face, DetectedFace):
        bounding_box = [[face.x, face.y],
                        [face.x + face.w, face.y],
                        [face.x + face.w, face.y + face.h],
                        [face.x, face.y + face.h]]
        landmarks = face.landmarksXY

    elif isinstance(face, dict):
        bounding_box = [[face.get("x", 0), face.get("y", 0)],
                        [face.get("x", 0) + face.get("w", 0),
                         face.get("y", 0)],
                        [face.get("x", 0) + face.get("w", 0),
                         face.get("y", 0) + face.get("h", 0)],
                        [face.get("x", 0),
                         face.get("y", 0) + face.get("h", 0)]]
        landmarks = face.get("landmarksXY", list())

    elif isinstance(face, dlib.rectangle):
        bounding_box = [[face.left(), face.top()],
                        [face.right(), face.top()],
                        [face.right(), face.bottom()],
                        [face.left(), face.bottom()]]
        landmarks = list()
    else:
        raise ValueError("Unsupported face type")
 </s> remove         if any(filters for filters in filter_files):
            facefilter = FaceFilter(filter_files[0],
                                    filter_files[1],
                                    self.args.ref_threshold)
        return facefilter
 </s> add         return rotation_matrix </s> remove         face.alignment_to_face(image, alignment)
 </s> add         face.from_alignment(alignment, image=image) </s> remove     def extract_multi_process(self):
        """ Run the extraction on the correct number of processes """
 </s> add         save_queue = queue_manager.get_queue("save")
        while True:
            item = save_queue.get()
            if item == "EOF":
                break
            filename, output_file, resized_face, idx = item
            out_filename = "{}_{}{}".format(str(output_file),
                                            str(idx),
                                            Path(filename).suffix)
            cv2.imwrite(out_filename, resized_face)

    def run_extraction(self, save_thread):
        """ Run Face Detection """
        to_process = self.process_item_count()
        if not item:
            continue
      rotation_matrix = cv2.invertAffineTransform(rotation_matrix)
      rotated = list()
      for item in (bounding_box, landmarks):
        if not item:
            continue
          points = np.array(item, np.int32)
          points = np.expand_dims(points, axis=0)
          transformed = cv2.transform(points,
                                      rotation_matrix).astype(np.int32)
          rotated.append(transformed.squeeze())
keep keep add keep keep keep keep keep
 Extraction - Speed improvements (#522) (#523)

* Extraction - Speed improvements (#522)

* Initial Plugin restructure

* Detectors to plugins. Detector speed improvements

* Re-implement dlib aligner, remove models, FAN to TF. Parallel processing

* Update manual, update convert, implement parallel/serial switching

* linting + fix cuda check (setup.py). requirements update keras 2.2.4

* Add extract size option. Fix dlib hog init

* GUI: Increase tooltip width

* Update alignment tool to support new DetectedFace

* Add skip existing faces option

* Fix sort tool to new plugin structure

* remove old align plugin

* fix convert -skip faces bug

* Fix convert skipping no faces frames

* Convert - draw onto transparent layer

* Fix blur threshold bug

* fix skip_faces convert bug

* Fix training 
lib/utils.py