Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'face_recognition_models' has no attribute 'face_locations' #6

Open
chaitanyajalluri opened this issue Jul 19, 2018 · 9 comments

Comments

@chaitanyajalluri
Copy link

when i am running the below line of code :
face_recognition_models.face_locations(rgb,model="cnn")
I am getting this error:
module 'face_recognition_models' has no attribute 'face_locations'

face_recognition_models contains same functions of face_recognition but why i am getting this error.

@maivtweb
Copy link

maivtweb commented Oct 1, 2018

you can change name .py file, maybe this is duplicate name

@sasauz
Copy link

sasauz commented Oct 11, 2019

I have the same error

@ageitgey
Copy link
Owner

You are importing the wrong module. Use face_recognition not face_recognition_models.

@sasauz
Copy link

sasauz commented Oct 11, 2019

Hi Adam, thank you for your answer.
If I'm trying to import face_recognition then I recive following error:

'[3]: runfile('C:/Users/sasa/.spyder-py3/temp.py', wdir='C:/Users/sasa/.spyder-py3')
Traceback (most recent call last):

File "", line 1, in
runfile('C:/Users/sasa/.spyder-py3/temp.py', wdir='C:/Users/sasa/.spyder-py3')

File "C:\Programming\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
execfile(filename, namespace)

File "C:\Programming\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/sasa/.spyder-py3/temp.py", line 9, in
import face_recognition

ModuleNotFoundError: No module named 'face_recognition'>'

@sasauz
Copy link

sasauz commented Oct 11, 2019

This is my code:

import cv2
import face_recognition

cv2.namedWindow("preview")
vc = cv2.VideoCapture(0)

face_locations = []

if vc.isOpened():
   rval, frame = vc.read()
else:
   rval = False

while rval:
   rval, frame = vc.read()
   rgb_frame = frame[:, :, ::-1]

   face_locations = face_recognition.face_locations(frame)
   cv2.imshow('preview', frame)

@ageitgey
Copy link
Owner

From the import error, it seems like you haven't actually installed face_recognition.

@hediil
Copy link

hediil commented Mar 19, 2022

You are importing the wrong module. Use face_recognition not face_recognition_models.

i cant import it i find error and i dont know why help me please

@hediil
Copy link

hediil commented Mar 19, 2022

how can i import face_recignition from pycharm

@skp-1997
Copy link

Check whether you have created face_recognition.py file in your code. If yes then change the name of the file. Its interfeering with existing file of face_recognition module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants