示例#1
0
 def __init__(self, prob_thresh, nms_thres, lw, model):
     self._MAX_INPUT_DIM = 5000.0
     self._prob_thresh = float(prob_thresh)
     self._nms_tresh = float(nms_thres)
     self._lw = int(lw)
     self._model_path = model
     self._model = tiny_face_model.Model(model)
示例#2
0
    def __init__(self, pickle_data, pickle_embs, tiny_model, openface_model, predicator_landmarks):
        self.data = Serializer.loading_data(pickle_data)
        self._pickles_embs = pickle_embs
        self._train_paths = glob.glob("Data/IMAGE_DB/*")
        self._nb_classes = len(self._train_paths)
        self._label_index = []

        self._tinyFace_model = tiny_face_model.Model(tiny_model)
        self._nn4_small2 = create_model()

        Colors.print_infos("[LOADING] Load the model size of openface")
        Colors.print_infos("[LOADING] Align the face Predicator 68 Face Landmarks")
        # self._nn4_small2.summary()

        self._nn4_small2.load_weights(openface_model)
        self._alignment = AlignDlib(predicator_landmarks)

        Colors.print_sucess("[LOADING] Loading Model Completed\n")
示例#3
0
    def __init__(self):
        # OpenCV HAAR
        self._faceCascade = cv2.CascadeClassifier(
            'Data/Model/haarcascade_frontalface_default.xml')

        # OpenCV DNN supports 2 networks.
        # 1. FP16 version of the original caffe implementation ( 5.4 MB )
        # 2. 8 bit Quantized version using Tensorflow ( 2.7 MB )
        DNN = "TF"

        if DNN == "CAFFE":
            self._modelFile = "Data/Model/res10_300x300_ssd_iter_140000_fp16.caffemodel"
            self._configFile = "Data/Model/deploy.prototxt"
            self._net = cv2.dnn.readNetFromCaffe(self._configFile,
                                                 self._modelFile)
        else:
            self._modelFile = "Data/Model/opencv_face_detector_uint8.pb"
            self._configFile = "Data/Model/opencv_face_detector.pbtxt"
            self._net = cv2.dnn.readNetFromTensorflow(self._modelFile,
                                                      self._configFile)

        self._conf_threshold = 0.8

        # DLIB HoG
        self._hogFaceDetector = dlib.get_frontal_face_detector()

        # DLIB MMOD
        self._dnnFaceDetector = dlib.cnn_face_detection_model_v1(
            'Data/Model/mmod_human_face_detector.dat')

        # TinyFace
        self._MAX_INPUT_DIM = 5000.0
        self._prob_thresh = float(0.5)
        self._nms_tresh = float(0.1)
        self._lw = int(3)
        self._model = tiny_face_model.Model('Data/Model/hr_res101.weight')