本文整理汇总了Python中dlib.face_recognition_model_v1方法的典型用法代码示例。如果您正苦于以下问题:Python dlib.face_recognition_model_v1方法的具体用法?Python dlib.face_recognition_model_v1怎么用?Python dlib.face_recognition_model_v1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dlib
的用法示例。
在下文中一共展示了dlib.face_recognition_model_v1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import dlib [as 别名]
# 或者: from dlib import face_recognition_model_v1 [as 别名]
def __init__(self, global_conf_in, prefix="DLIBFEAT_"):
"""DLibFeaturizer constructor.
:param global_conf_in: configuration file or dictionary
:type global_conf_in: str, dict
:param prefix: prefix in configuration
:type prefix: str
:raise ValueError: if ``pred_path`` or ``rec_path`` is not set in configuration
"""
super(DLibFeaturizer, self).__init__(global_conf_in, prefix)
self.set_pp(pp="DLibFeaturizer")
if self.verbose > 0:
print("[{}.log] global_conf: {}".format(self.pp, self.global_conf))
# Get shape predictor
pred_path = self.get_required_param('pred_path')
# Test if file exits there
if not os.path.exists(pred_path):
# Download file if not
download_model(www_pred_path, pred_path, pred_bz2_file)
# Intialize shape predictor
self.sp = dlib.shape_predictor(str(pred_path))
# Get recognizer model
rec_path = self.get_required_param('rec_path')
# Test if file exits there
if not os.path.exists(rec_path):
# Download file if not
download_model(www_rec_path, rec_path, rec_bz2_file)
# Initialize recognizer model
self.facerec = dlib.face_recognition_model_v1(str(rec_path))