module'dlib'没有属性'get_frontal_face_detector'错误

问题描述 投票:0回答:2

我正在尝试在Anaconda上使用Face_Recognition包,我已经安装了dlib和face_recognition库

但是当我在代码中导入face_recognition时,出现此错误消息

import dlib
import face_recognition



---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-32-cc760b0b6613> in <module>()
      1 import dlib
----> 2 import face_recognition

~\Anaconda3\lib\site-packages\face_recognition\__init__.py in <module>()
      5 __version__ = '1.2.3'
      6 
----> 7 from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance

~\Anaconda3\lib\site-packages\face_recognition\api.py in <module>()
     15 ImageFile.LOAD_TRUNCATED_IMAGES = True
     16 
---> 17 face_detector = dlib.get_frontal_face_detector()
     18 
     19 predictor_68_point_model = face_recognition_models.pose_predictor_model_location()

AttributeError: module 'dlib' has no attribute 'get_frontal_face_detector'
python anaconda face-recognition dlib
2个回答
0
投票

检查本教程:http://www.programmersought.com/article/7562877819/

运行代码错误:检测器= dlib.get_frontal_face_detector()AttributeError:模块'Dlib'没有 属性“ get_frontal_face_detector”或无法打开 “ get_frontal_face_detector”等,因为您没有下载 人脸数据库shape_predictor_68_face_landmarks,您需要 下载并解压缩,并将其放在您的代码所在的文件夹中 位于。人脸库下载 链接:http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2


0
投票

尝试以下解决方案:

  1. 重新安装dlib程序包(pip3 uninstall dlib,然后再安装pip3 install dlib
  2. 从源代码安装dlib(对我有用。链接:http://dlib.net/compile.html
© www.soinside.com 2019 - 2024. All rights reserved.