dlib_worker.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:tdesc 作者: bkj 项目源码 文件源码
def __init__(self, num_jitters=10, dnn=False, det_threshold=0.0, upsample=0):
        import_dlib()

        ppath = os.path.join(os.environ['HOME'], '.tdesc')

        if not dnn:
            self.detector = dlib.get_frontal_face_detector()
        else:
            detpath = os.path.join(ppath, 'models/dlib/mmod_human_face_detector.dat')
            self.detector = dlib.face_detection_model_v1(detpath)

        shapepath = os.path.join(ppath, 'models/dlib/shape_predictor_68_face_landmarks.dat')
        self.sp = dlib.shape_predictor(shapepath)

        facepath = os.path.join(ppath, 'models/dlib/dlib_face_recognition_resnet_model_v1.dat')
        self.facerec = dlib.face_recognition_model_v1(facepath)

        self.num_jitters = num_jitters
        self.dnn = dnn
        self.det_threshold = det_threshold
        self.upsample = upsample

        print >> sys.stderr, 'DlibFaceWorker: ready (dnn=%d | num_jitters=%d)' % (int(dnn), int(num_jitters))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号