face_recognition
face_recognition copied to clipboard
File Not Found Error
- face_recognition version:
- Python version:
- Operating System:
Description
Amazing code btw, I am a beginner and I copied the code for the live webcam into my windows 10 command prompt, I changed the first image and face encoding to put my own in there, but it says it can't be found.
What I Did
This is what i changed
me_image = face_recognition.load_image_file("me.jpg")
me_face_encoding = face_recognition.face_encodings(me_image)[0]
This is what I get
Traceback (most recent call last):
File "live_face_camera_add_people", line 14, in <module>
me_image = face_recognition.load_image_file("me.jpg")
File "C:\Users\jnort\AppData\Local\Programs\Python\Python37-32\lib\site-packages\face_recognition\api.py", line 83, in load_image_file
im = PIL.Image.open(file)
File "C:\Users\jnort\AppData\Local\Programs\Python\Python37-32\lib\site-packages\PIL\Image.py", line 2652, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'me.jpg'
[ WARN:0] terminating async callback
Please Help!!!
Is "me.jpg" in the same directory the script is running from? If not, either put it there, or try setting an absolute path.
me_image = face_recognition.load_image_file("C:\Users\Jacob\Pictures\me.jpg")
or whatever
If you haven't yet solved the issue, here are a few things that fixed my error:
- Make sure your image and script are in the same directory.
- Next, Just include file on its own, without the folder. eg: Instead of "Folder/file.jpg", change it to, "file.jpg"