ageitgey / face_recognition_models

Trained models for the face_recognition python library
Creative Commons Zero v1.0 Universal
359 stars 180 forks source link

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

Open chaitanyajalluri opened 6 years ago

chaitanyajalluri commented 6 years ago

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 commented 6 years ago

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

sasauz commented 5 years ago

I have the same error

ageitgey commented 5 years ago

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

sasauz commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

hediil commented 2 years ago

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 commented 2 years ago

how can i import face_recignition from pycharm

skp-1997 commented 2 years ago

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.