  class FaceFilter():
      """ Face filter for extraction """
      def __init__(self, reference_file_paths, nreference_file_paths, threshold=0.6):
          logger.debug("Initializing %s: (reference_file_paths: %s, nreference_file_paths: %s, "
                       "threshold: %s)", self.__class__.__name__, reference_file_paths,
                       nreference_file_paths, threshold)
          images = list(map(face_recognition.load_image_file, reference_file_paths))
          nimages = list(map(face_recognition.load_image_file, nreference_file_paths))
          # Note: we take only first face, so the reference file should only contain one face.
          self.encodings = list(map(lambda im: face_recognition.face_encodings(im)[0], images))
          self.nencodings = list(map(lambda im: face_recognition.face_encodings(im)[0], nimages))
          self.threshold = threshold
          logger.trace("encodings: %s", self.encodings)
          logger.trace("nencodings: %s", self.nencodings)
          logger.debug("Initialized %s", self.__class__.__name__)
  
 
</s> remove     """ Face filter for extraction """
    def __init__(self, reference_file_paths, nreference_file_paths, threshold=0.6):
 </s> add     """ Face filter for extraction
        NB: we take only first face, so the reference file should only contain one face. """

    def __init__(self, reference_file_paths, nreference_file_paths, detector, aligner, loglevel,
                 multiprocess=False, threshold=0.4):
 </s> remove         logger.trace("encodings: %s", self.encodings)
        logger.trace("nencodings: %s", self.nencodings)
 </s> add  </s> remove     def __init__(self, loglevel, model_filename=None, rotation=None, min_size=0):
        logger.debug("Initializing %s: (model_filename: %s, rotation: %s, min_size: %s)",
                     self.__class__.__name__, model_filename, rotation, min_size)
 </s> add     def __init__(self, loglevel,
                 git_model_id=None, model_filename=None, rotation=None, min_size=0):
        logger.debug("Initializing %s: (loglevel: %s, git_model_id: %s, model_filename: %s, "
                     "rotation: %s, min_size: %s)", self.__class__.__name__, loglevel,
                     git_model_id, model_filename, rotation, min_size) </s> remove     def __init__(self, loglevel, model_filename=None, colorspace="BGR", input_size=256):
        logger.debug("Initializing %s: (model_filename: '%s', colorspace: '%s'. input_size: %s)",
                     self.__class__.__name__, model_filename, colorspace, input_size)
 </s> add     def __init__(self, loglevel,
                 git_model_id=None, model_filename=None, colorspace="BGR", input_size=256):
        logger.debug("Initializing %s: (loglevel: %s, git_model_id: %s, model_filename: '%s', "
                     "colorspace: '%s'. input_size: %s)", self.__class__.__name__, loglevel,
                     git_model_id, model_filename, colorspace, input_size) </s> remove         """ Check Face
            we could use detected landmarks, but I did not manage to do so.
            TODO The copy/paste below should help """
 </s> add         """ Check the extracted Face """

                     "detector: %s, aligner: %s. loglevel: %s, multiprocess: %s, threshold: %s)",
                     self.__class__.__name__, reference_file_paths, nreference_file_paths,
                     detector, aligner, loglevel, multiprocess, threshold)
        git_model_id = 7
        model_filename = ["vgg_face_v1.caffemodel", "vgg_face_v1.prototxt"]

        self.input_size = 224
        self.numeric_loglevel = get_loglevel(loglevel)
        self.vgg_face = self.get_model(git_model_id, model_filename)
        self.filters = self.load_images(reference_file_paths, nreference_file_paths)
        self.align_faces(detector, aligner, loglevel, multiprocess)
        self.get_filter_encodings()

  class FaceFilter():
      """ Face filter for extraction """
      def __init__(self, reference_file_paths, nreference_file_paths, threshold=0.6):
          logger.debug("Initializing %s: (reference_file_paths: %s, nreference_file_paths: %s, "
                     "detector: %s, aligner: %s. loglevel: %s, multiprocess: %s, threshold: %s)",
                     self.__class__.__name__, reference_file_paths, nreference_file_paths,
                     detector, aligner, loglevel, multiprocess, threshold)
        git_model_id = 7
        model_filename = ["vgg_face_v1.caffemodel", "vgg_face_v1.prototxt"]

        self.input_size = 224
        self.numeric_loglevel = get_loglevel(loglevel)
        self.vgg_face = self.get_model(git_model_id, model_filename)
        self.filters = self.load_images(reference_file_paths, nreference_file_paths)
        self.align_faces(detector, aligner, loglevel, multiprocess)
        self.get_filter_encodings()
                     "detector: %s, aligner: %s. loglevel: %s, multiprocess: %s, threshold: %s)",
                     self.__class__.__name__, reference_file_paths, nreference_file_paths,
                     detector, aligner, loglevel, multiprocess, threshold)
        git_model_id = 7
        model_filename = ["vgg_face_v1.caffemodel", "vgg_face_v1.prototxt"]

        self.input_size = 224
        self.numeric_loglevel = get_loglevel(loglevel)
        self.vgg_face = self.get_model(git_model_id, model_filename)
        self.filters = self.load_images(reference_file_paths, nreference_file_paths)
        self.align_faces(detector, aligner, loglevel, multiprocess)
        self.get_filter_encodings()
                     "detector: %s, aligner: %s. loglevel: %s, multiprocess: %s, threshold: %s)",
                     self.__class__.__name__, reference_file_paths, nreference_file_paths,
                     detector, aligner, loglevel, multiprocess, threshold)
        git_model_id = 7
        model_filename = ["vgg_face_v1.caffemodel", "vgg_face_v1.prototxt"]

        self.input_size = 224
        self.numeric_loglevel = get_loglevel(loglevel)
        self.vgg_face = self.get_model(git_model_id, model_filename)
        self.filters = self.load_images(reference_file_paths, nreference_file_paths)
        self.align_faces(detector, aligner, loglevel, multiprocess)
        self.get_filter_encodings()
                     "detector: %s, aligner: %s. loglevel: %s, multiprocess: %s, threshold: %s)",
                     self.__class__.__name__, reference_file_paths, nreference_file_paths,
                     detector, aligner, loglevel, multiprocess, threshold)
        git_model_id = 7
        model_filename = ["vgg_face_v1.caffemodel", "vgg_face_v1.prototxt"]

        self.input_size = 224
        self.numeric_loglevel = get_loglevel(loglevel)
        self.vgg_face = self.get_model(git_model_id, model_filename)
        self.filters = self.load_images(reference_file_paths, nreference_file_paths)
        self.align_faces(detector, aligner, loglevel, multiprocess)
        self.get_filter_encodings()
                     "detector: %s, aligner: %s. loglevel: %s, multiprocess: %s, threshold: %s)",
                     self.__class__.__name__, reference_file_paths, nreference_file_paths,
                     detector, aligner, loglevel, multiprocess, threshold)
        git_model_id = 7
        model_filename = ["vgg_face_v1.caffemodel", "vgg_face_v1.prototxt"]

        self.input_size = 224
        self.numeric_loglevel = get_loglevel(loglevel)
        self.vgg_face = self.get_model(git_model_id, model_filename)
        self.filters = self.load_images(reference_file_paths, nreference_file_paths)
        self.align_faces(detector, aligner, loglevel, multiprocess)
        self.get_filter_encodings()
                     "detector: %s, aligner: %s. loglevel: %s, multiprocess: %s, threshold: %s)",
                     self.__class__.__name__, reference_file_paths, nreference_file_paths,
                     detector, aligner, loglevel, multiprocess, threshold)
        git_model_id = 7
        model_filename = ["vgg_face_v1.caffemodel", "vgg_face_v1.prototxt"]

        self.input_size = 224
        self.numeric_loglevel = get_loglevel(loglevel)
        self.vgg_face = self.get_model(git_model_id, model_filename)
        self.filters = self.load_images(reference_file_paths, nreference_file_paths)
        self.align_faces(detector, aligner, loglevel, multiprocess)
        self.get_filter_encodings()
                     "detector: %s, aligner: %s. loglevel: %s, multiprocess: %s, threshold: %s)",
                     self.__class__.__name__, reference_file_paths, nreference_file_paths,
                     detector, aligner, loglevel, multiprocess, threshold)
        git_model_id = 7
        model_filename = ["vgg_face_v1.caffemodel", "vgg_face_v1.prototxt"]

        self.input_size = 224
        self.numeric_loglevel = get_loglevel(loglevel)
        self.vgg_face = self.get_model(git_model_id, model_filename)
        self.filters = self.load_images(reference_file_paths, nreference_file_paths)
        self.align_faces(detector, aligner, loglevel, multiprocess)
        self.get_filter_encodings()
          self.threshold = threshold
          logger.trace("encodings: %s", self.encodings)
          logger.trace("nencodings: %s", self.nencodings)
          logger.debug("Initialized %s", self.__class__.__name__)
  
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
 Face filter vgg face (#724)

* Implement extraction pipeline

* Face filter to vgg_face. Resume partial model downloads

* On-the-fly conversion to extraction pipeline

* Move git model ids from get_model to model definition 
lib/face_filter.py