Esempio n. 1
0
 def __init__(
     self,
     min_face_size: int = 40,
     steps_threshold: list = None,
     scale_factor: float = 0.7,
 ):
     """
     Initializes the MTCNN.
     :param min_face_size: minimum size of the face to detect
     :param steps_threshold: step's thresholds values
     :param scale_factor: scale factor
     """
     if steps_threshold is None:
         steps_threshold = [0.6, 0.7,
                            0.7]  # original mtcnn values [0.6, 0.7, 0.7]
     self._min_face_size = min_face_size
     self._steps_threshold = steps_threshold
     self._scale_factor = scale_factor
     self.p_net = tflite.Interpreter(
         model_path=get_file(BASE_URL +
                             "p_net.tflite", FILE_HASHES["p_net"]))
     self.r_net = tflite.Interpreter(
         model_path=get_file(BASE_URL +
                             "r_net.tflite", FILE_HASHES["r_net"]))
     self.o_net = tflite.Interpreter(
         model_path=get_file(BASE_URL +
                             "o_net.tflite", FILE_HASHES["o_net"]))
Esempio n. 2
0
 def __init__(
     self,
     model_path: str = None,
     model_type: str = "mobileNet",
 ):
     if model_path is None:
         model_path = get_file(BASE_URL + model_type + ".tflite", FILE_HASHES[model_type])
     self.face_recognizer = tflite.Interpreter(model_path=model_path)
Esempio n. 3
0
 def __init__(self, gal_dir: str = None):
     self.detector = FaceDetection()
     self.recognizer = FaceRecognition()
     self.gal_embs = []
     self.gal_names = []
     self.gal_faces = []
     self.gal_dir = (gal_dir if gal_dir is not None else get_file(
         BASE_URL + "sample_gallery.zip",
         FILE_HASHES["sample_gallery"],
         is_zip=True))
     self.update_gallery()