Open kaykyeing0209 opened 3 years ago
You can troubleshoot this problem as follows:
First, please shorten you project folder name and replace spaces with underscores OR move base directory of project to D:\
Second: It looks like a permission problem as well. Try running the Pycharm as Administrator privileges.
Third: Try File Menu -> Invalidate Cache / Restart.
under Pycharm menu
我也是同样的问题
How do you soved this problem ?
In my case, i am using pyenv then sometime face_recognition and python is installed in different location. e.g. python is in .../3.7/... but face_recognition is in ../3.9/... it means my python is version 3.7, but face_recognition is for python 3.9 so python 3.7 cannot find face_recognition for itself.
My solution is to ensure python version is to upgrade python to be the same version as face_recognition. I am using pyenv to install and select version to run python
Description
I am researching about facial recognition I was researching and I found this program on the youtube channel (https://www.youtube.com/watch?v=sz25xxF_AVE) but when I try to run the program it gives this error
Traceback (most recent last call): File "D: / kayky / automation / facial recognition test9 / pythonProject / main.py", line 2, in
import face_recognition
File "D: \ kayky \ automation \ teste9 facial recognition \ pythonProject \ venv \ lib \ site-packages \ face_recognition \ init.py", line 7, in
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "D: \ kayky \ automation \ teste9 facial recognition \ pythonProject \ venv \ lib \ site-packages \ face_recognition \ api.py", line 20, in
pose_predictor_68_point = dlib.shape_predictor (predictor_68_point_model)
RuntimeError: cannot open D: \ kayky \ automation \ test9 facial recognition \ pythonProject \ venv \ lib \ site-packages \ face_recognition_models \ models \ shape_predictor_68_face_landmarks.dat
What I Did
I installed all the import that are requested in the video but it didn't work
cmake 3.17.2 dlib 19.18.0 face-recognition 1.3.0 numpy 1.19.0rc1 opencv-python 4.2.0.34
code
import cv2 import face_recognition imgElon = face_recognition.load_image_file('ImagesBasic/Elon Musk.jpg') imgElon = cv2.cvtColor(imgElon,cv2.COLOR_BGR2RGB) imgTest = face_recognition.load_image_file('ImagesBasic/Bill gates.jpg') imgTest = cv2.cvtColor(imgTest,cv2.COLOR_BGR2RGB) faceLoc = face_recognition.face_locations(imgElon)[0] encodeElon = face_recognition.face_encodings(imgElon)[0] cv2.rectangle(imgElon,(faceLoc[3],faceLoc[0]),(faceLoc[1],faceLoc[2]),(255,0,255),2) faceLocTest = face_recognition.face_locations(imgTest)[0] encodeTest = face_recognition.face_encodings(imgTest)[0] cv2.rectangle(imgTest,(faceLocTest[3],faceLocTest[0]),(faceLocTest[1],faceLocTest[2]),(255,0,255),2) results = face_recognition.compare_faces([encodeElon],encodeTest) faceDis = face_recognition.face_distance([encodeElon],encodeTest) print(results,faceDis) cv2.putText(imgTest,f'{results} {round(faceDis[0],2)}',(50,50),cv2.FONT_HERSHEY_COMPLEX,1,(0,0,255),2) cv2.imshow('Elon Musk',imgElon) cv2.imshow('Elon Test',imgTest) cv2.waitKey(0)
Paste the command(s) you ran and the output.
Traceback (most recent call last): File "D:/kayky/automaçao/teste9 reconhecimento facial/pythonProject/main.py", line 2, in
import face_recognition
File "D:\kayky\automaçao\teste9 reconhecimento facial\pythonProject\venv\lib\site-packages\face_recognition__init__.py", line 7, in
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "D:\kayky\automaçao\teste9 reconhecimento facial\pythonProject\venv\lib\site-packages\face_recognition\api.py", line 20, in
pose_predictor_68_point = dlib.shape_predictor(predictor_68_point_model)
RuntimeError: Unable to open D:\kayky\automaçao\teste9 reconhecimento facial\pythonProject\venv\lib\site-packages\face_recognition_models\models\shape_predictor_68_face_landmarks.dat
images