0

我正在尝试在 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'
4

3 回答 3

0

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

运行代码时报错:detector = dlib.get_frontal_face_detector() AttributeError: module 'dlib' has no attribute 'get_frontal_face_detector' or can't open 'get_frontal_face_detector'等,因为你没有下载人脸库shape_predictor_68_face_landmarks,需要下载并解压缩并将其放在代码所在的文件夹中。人脸库下载链接:http ://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2

于 2020-05-18T21:42:27.153 回答
0

尝试以下解决方案:

  1. 重新安装dlib包 ( pip3 uninstall dlib, 然后pip3 install dlib
  2. 从源代码安装dlib(对我有用。链接:http ://dlib.net/compile.html )
于 2020-05-18T21:53:28.090 回答
0

我跟着这个线程工作并喜欢魅力。点击[这里](https://stackoverflow.com/a/49538054/14945612)!2021 年 7 月检查问题可能出在 c++ 编译器(Visual Studio)和 Cmake 安装上。确保在要安装 dlib 的虚拟环境的 site_packages 文件夹中调用命令提示符。安装后尝试调用

导入 dlib

dlib。版本

如果这可行,那么问题可能是一个错字。您可以从 [此处] ( http://dlib.net/python/index.html#dlib.get_frontal_face_detector )确认您正在调用的函数是否存在!

于 2021-07-13T16:33:01.060 回答