          facefilter = None
          filter_files = [self.set_face_filter(filter_type)
                          for filter_type in ('filter', 'nfilter')]
  
          if any(filters for filters in filter_files):
              facefilter = FaceFilter(filter_files[0],
                                      filter_files[1],
                                      self.args.ref_threshold)
          return facefilter
  
      def set_face_filter(self, filter_list):
          """ Set the required filters """
          filter_files = list()
          filter_args = getattr(self.args, filter_list)
 
</s> remove     def set_face_filter(self, filter_list):
        """ Set the required filters """
        filter_files = list()
        filter_args = getattr(self.args, filter_list)
        if filter_args:
            print("{}: {}".format(filter_list.title(), filter_args))
            filter_files = filter_args
            if not isinstance(filter_args, list):
                filter_files = [filter_args]
            filter_files = list(filter(lambda fnc: Path(fnc).exists(),
                                       filter_files))
        return filter_files
 </s> add  </s> remove     def load_face_filter(self):
        """ Load faces to filter out of images """
        facefilter = None
        filter_files = [self.set_face_filter(filter_type)
                        for filter_type in ('filter', 'nfilter')]
 </s> add         abs_cos = abs(rotation_matrix[0, 0])
        abs_sin = abs(rotation_matrix[0, 1])
        rotated_width = int(height*abs_sin + width*abs_cos)
        rotated_height = int(height*abs_cos + width*abs_sin)
        rotation_matrix[0, 2] += rotated_width/2 - center[0]
        rotation_matrix[1, 2] += rotated_height/2 - center[1] </s> remove     def get_alignments_path(self):
        """ Return the path to alignments file """
        if self.args.alignments_path:
            alignfile = self.args.alignments_path
        else:
            alignfile = os.path.join(
                str(self.args.input_dir),
                "alignments.{}".format(self.serializer.ext))
        print("Alignments filepath: %s" % alignfile)
        return alignfile
 </s> add         if any(filters for filters in filter_files):
            facefilter = FilterFunc(filter_files[0],
                                    filter_files[1],
                                    ref_threshold)
        return facefilter </s> remove     def get_mtcnn_kwargs(self):
        """ Add the mtcnn arguments into a kwargs dictionary """
        mtcnn_threshold = [float(thr.strip())
                           for thr in self.args.mtcnn_threshold]
        return {"minsize": self.args.mtcnn_minsize,
                "threshold": mtcnn_threshold,
                "factor": self.args.mtcnn_scalefactor}
 </s> add     @staticmethod
    def get_original_rotation_matrix(dimensions, angle):
        """ Calculate original rotation matrix and invert """
        height, width = dimensions
        center = (width/2, height/2)
        rotation_matrix = cv2.getRotationMatrix2D(center, -1.0*angle, 1.) </s> remove     def read_alignments(self):
        """ Read the serialized alignments file """
        try:
            with open(self.alignments_path, self.serializer.roptions) as align:
                faces_detected = self.serializer.unmarshal(align.read())
        except Exception as err:
            print("{} not read!".format(self.alignments_path))
            print(str(err))
            faces_detected = dict()
        return faces_detected
 </s> add     @staticmethod
    def set_face_filter(f_type, f_args):
        """ Set the required filters """
        if not f_args:
            return list()
        return rotation_matrix
          facefilter = None
          filter_files = [self.set_face_filter(filter_type)
                          for filter_type in ('filter', 'nfilter')]
  
        return rotation_matrix
        return rotation_matrix
        return rotation_matrix
        return rotation_matrix
        return rotation_matrix
  
      def set_face_filter(self, filter_list):
          """ Set the required filters """
          filter_files = list()
          filter_args = getattr(self.args, filter_list)
keep keep keep keep replace replace replace replace replace 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 
scripts/fsmedia.py