-1

I am getting an error while importing the face_recognition library. I have tried using a Virtual Environment too. Please help.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python38\lib\site-packages\face_recognition-1.3.0-py3.8.egg\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:\Program Files\Python38\lib\site-packages\face_recognition-1.3.0-py3.8.egg\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'

Version: Python 3.8 OS: Windows 10

Giga Blitz
  • 46
  • 1
  • 2
  • 7

1 Answers1

0

You need to download the face database shape_predictor_68_face_landmarks, you need to download it and unzip it and put it in the folder where your code is located

Face Library Download Link:http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2

Sachin Yadav
  • 748
  • 9
  • 28
  • What is the new error that you are getting, according to me it should work – Sachin Yadav Jul 28 '20 at 13:59
  • Same as before. Should I link it to the code and if so how should I? New error added - File "C:\Users\HP\Desktop\Achu\Python-Codes\Ida\Ida (Text-based Assistant).py", line 32, in import cv2, face_recognition – Giga Blitz Jul 28 '20 at 14:09
  • The above solution worked for me but you can refer this if you are still not getting it http://dlib.net/face_landmark_detection.py.html – Sachin Yadav Jul 28 '20 at 14:21
  • I'm afraid it didn't work. I finally settled on using OpenCV2 for face_recognition. – Giga Blitz Aug 01 '20 at 14:19