[英]Installing dlib to work with facial recognition [dlib has no attribute - get_frontal_face_detector]
I have been playing with facial recognition a little bit in python, but have been having trouble with getting dlib to work.我在 python 中一直在玩面部识别,但在让 dlib 工作时遇到了麻烦。
I am on a windows 10 environment, working inside of the Pycharm terminal using pip to install everything.我在 windows 10 环境中,在 Pycharm 终端内部工作,使用 pip 安装所有东西。 When I try to install dlib inside of the terminal, I get a message stating it failed with error code 1.当我尝试在终端内安装 dlib 时,我收到一条消息,指出它失败,错误代码为 1。
Command "C:\Users\Jonathan\PycharmProjects\image_recognition\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Jonathan\\AppData\\Local\\Temp\\pip-install-87y4zmcs\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Jonathan\AppData\Local\Temp\pip-record-ug95jqxj\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\Jonathan\PycharmProjects\image _recognition\venv\include\site\python3.7\dlib" failed with error code 1 in C:\Users\Jonathan\AppData\Local\Temp\pip-install-87y4zmcs\dlib\
So i opened up the dlib tar.zip file, extracted it, and ran the setup.py and copied the dlib folder inside of that into my site-packages folder.所以我打开了 dlib tar.zip 文件,将其解压缩,然后运行 setup.py 并将其中的 dlib 文件夹复制到我的站点包文件夹中。
After that when I try to use the python library face_recognition, I get this error from dlib- C:\Users\Jonathan\PycharmProjects\image_recognition\venv\Scripts\python.exe C:/Users/Jonathan/PycharmProjects/image_recognition/image_recognition.py Traceback (most recent call last): File "C:/Users/Jonathan/PycharmProjects/image_recognition/image_recognition.py", line 1, in <module> import face_recognition File "C:\Users\Jonathan\PycharmProjects\image_recognition\face_recognition\__init__.py", line 7, in <module> from.api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance File "C:\Users\Jonathan\PycharmProjects\image_recognition\face_recognition\api.py", line 17, in <module> face_detector = dlib.get_frontal_face_detector() AttributeError: module 'dlib' has no attribute 'get_frontal_face_detector'
After that when I try to use the python library face_recognition, I get this error from dlib- C:\Users\Jonathan\PycharmProjects\image_recognition\venv\Scripts\python.exe C:/Users/Jonathan/PycharmProjects/image_recognition/image_recognition.py Traceback (most recent call last): File "C:/Users/Jonathan/PycharmProjects/image_recognition/image_recognition.py", line 1, in <module> import face_recognition File "C:\Users\Jonathan\PycharmProjects\image_recognition\face_recognition\__init__.py", line 7, in <module> from.api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance File "C:\Users\Jonathan\PycharmProjects\image_recognition\face_recognition\api.py", line 17, in <module> face_detector = dlib.get_frontal_face_detector() AttributeError: module 'dlib' has no attribute 'get_frontal_face_detector'
I have installed cmake within the terminal as well before I ran the face_recognition.在运行 face_recognition 之前,我已经在终端内安装了 cmake。 Any help would be appreciated.任何帮助,将不胜感激。 I will be able to check this in about 15-20 minutes.我将能够在大约 15-20 分钟内进行检查。
Check this solution from below link, AttributeError: 'module' object has no attribute 'get_frontal_face_detector' .从以下链接检查此解决方案, AttributeError: 'module' object has no attribute 'get_frontal_face_detector' 。
And the face recognition module requires dlib version should be above 19.+.并且人脸识别模块要求dlib版本应该在19.+以上。
I'd used 19.17 in my project and installed via conda environment, How can I solve Error of installation Dlib?我在项目中使用了 19.17 并通过 conda 环境安装, 如何解决安装 Dlib 的错误? ) )
This solves my problem:这解决了我的问题:
AttributeError: 'module' object has no attribute 'get_frontal_face_detector' AttributeError:“模块”object 没有属性“get_frontal_face_detector”
pip uninstall dlib
pip install dlib
Os:Macos操作系统:Macos
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.