Esempio n. 1
0
    def __init__(self, db_path, trained_face_dir):
        super(FaceCenterOf, self).__init__(db_path, trained_face_dir)
        self._log = log_center.make_logger(__name__, logging.DEBUG)

        self._trained_face_dir = trained_face_dir
        self._face_db = faceapi.database.make_db_manager(db_path)
        self._face_detector = faceapi.detecter.make_detector()
        self._face_eigener = faceapi.eigener.make_eigener()
        self._face_classifier = faceapi.classifier.make_classifier(db_path)
    def __init__(self, db_file, trained_face_dir):
        super(FaceCenterOf, self).__init__(db_file, trained_face_dir)
        self._log = log_center.make_logger(__name__, logging.DEBUG)

        self._trained_face_dir = trained_face_dir
        if not os.path.exists(trained_face_dir):
            os.makedirs(trained_face_dir)

        self._save_result = False
        self._face_db = faceapi.database.make_db_manager(db_file)
        self._face_detector = faceapi.detecter.make_detector()
        self._face_eigener = faceapi.eigener.make_eigener()
        self._face_classifier = faceapi.classifier.make_classifier(db_file)
        self._training_id = -1
        self._trainint_name = ''
        self._trainint_cb = None
    def __init__(self, db_file=_DB_FILE):
        super(DbManagerOpenface, self).__init__(db_file)
        self._db_file = db_file
        self._log = log_center.make_logger(__name__, logging.INFO)
        self._log.info("db_file: {}".format(db_file))

        dir = os.path.dirname(db_file)
        if not os.path.exists(dir):
            os.makedirs(dir)

        try:
            with sqlite3.connect(self._db_file) as db:
                cur = db.cursor()
                cur.execute(_SQL_CMD_CREATE_TAB + _SQL_TABLE_FACE)
                db.commit()
        except sqlite3.Error as e:
            self._log.error(str(e))
Esempio n. 4
0
    def __init__(self, db_file):
        super(ClassifierOf, self).__init__(db_file)
        self._log = log_center.make_logger(__name__, logging.INFO)
        self._face_db = faceapi.database.make_db_manager(db_file)

        db_dir = os.path.dirname(os.path.realpath(db_file))
        svm_dir = os.path.join(db_dir, 'svm')
        self._svm_file = os.path.join(svm_dir, _DEFAULT_SVM_FILE_NAME)

        if not os.path.exists(svm_dir):
            os.makedirs(svm_dir)

        self._db_dict = {}
        for info in self._face_db.dbList():
            h = info['hash'].encode('ascii', 'ignore')
            info.pop("hash", None)
            self._db_dict[h] = info

        if os.path.isfile(self._svm_file):
            self._log.info("Load saved svm result")
            self._svm = joblib.load(self._svm_file)
        else:
            self._log.info("No saved svm, update from db")
            self.updateDB()
Esempio n. 5
0
 def __init__(self):
     super(EigenerOf, self).__init__()
     self._log = log_center.make_logger(__name__, logging.DEBUG)
Esempio n. 6
0
 def __init__(self, dir_path):
     super(ClassifierOf, self).__init__(dir_path)
     self._log = log_center.make_logger(__name__, logging.INFO)
     self._face_db = faceapi.database.make_db_manager(dir_path)
     self.updateDB()
Esempio n. 7
0
 def __init__(self):
     super(FaceDetectorOf, self).__init__()
     self._logger = log_center.make_logger(__name__, logging.INFO)