Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pycharm face recognition
#1
I am very new to pycharm and face_recognition, and I am trying to play with them a little.
First of all, here's my code and error:

import face_recognition
face_recognition


bill_gates_pic = face_recognition.load_image_file('./Desktop/pics_python/bill gates.jpg')
bill_gates_face_location = face_recognition.face_locations(bill_gates_pic)

print(bill_gates_face_location)
Error:
C:\Users\PycharmProjects\faces\venv\Scripts\python.exe C:/Users/PycharmProjects/faces/face.py Traceback (most recent call last): File "C:/Users/PycharmProjects/faces/face.py", line 5, in <module> bill_gates_pic = face_recognition.load_image_file('./Desktop/pics_python/bill gates.jpg') File "C:\Users\PycharmProjects\faces\venv\lib\site-packages\face_recognition\api.py", line 83, in load_image_file im = PIL.Image.open(file) File "C:\Users\PycharmProjects\faces\venv\lib\site-packages\PIL\Image.py", line 2652, in open fp = builtins.open(filename, "rb") FileNotFoundError: [Errno 2] No such file or directory: './Desktop/pics_python/bill gates.jpg' Process finished with exit code 1
Now I have a few general questions:

1-as you can see, in line 2 I had to write 'face_recognition' again because the minute I don't, line 1 becomes
inactive.Why so?
2-It looks like that anytime I start a new project, I have to install 'face_recognition' again, how come?
3-pycharm runs slowly, is it normal?
4- what is the best way to start a project in pycharm? In spyder all I do is to click 'new file' in the upper right corner, isn't it supposed to be as simple in pycharm?


Thank you in advance.
Reply
#2
face recognition has nothing to do with pycharm.
pycharm is an IDE, not a language. Any python code that will run in pycharm will run on it's own, or in any other IDE.

So proper question is what packages are used by python.
With that said, see: https://pypi.org/search/?q=face+recognition
Reply
#3
I never said that pycharm is a language, I obviously know is a compiler.
However, the problems listed above still persist.
How so?
The link you sent me has exactly the same line of code that I wrote, yet,
the issues are still there.
Reply
#4
pycharm is not a compiler either, it's an IDE an editor.
The link that I sent is a URL for python packages having to do with facial recognition
Reply
#5
I managed to make the program run, however, now I am running into a semantic error.
The 'unknown picture' I have chosen is someone who looks like bill gates but is not him,
however, the outcome I get is: "this is bill gates".
Do you perhaps know what's wrong?

Moreover, pycharm is still taking awhile before displaying the outcome (20 sec or something),
do you perhaps know why?
Is it normal?

import face_recognition


bill_gates_pic = face_recognition.load_image_file('./pics_python/bill gates.jpg')
bill_gates_face_location = face_recognition.face_locations(bill_gates_pic)
bill_face_encoding=face_recognition.face_encodings(bill_gates_pic)[0]

unknown_face = face_recognition.load_image_file('./pics_python/bill-gates-lookalike.jpg')
unknown_face_encoding=face_recognition.face_encodings(unknown_face)[0]


results = face_recognition.compare_faces([bill_face_encoding], unknown_face_encoding)

if results[0]:
    print('this is bill gates')
else:
    print('this is NOT bill gates')

by the way, this is the lookalike picture I am using:

http://www.lookalike.com/lookalikes/bill-gates-2.htm
Reply
#6
I have never used this package, but looking at the docs, I see that you can isolate parts, eyes, nose, etc.
Perhaps comparing these might help.

Also, see this on changing tolerance: https://github.com/ageitgey/face_recognition/issues/160
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to zoom on/follow MOUTH in FACE? (OPENCV Face Detection) buzzdarkyear 2 1,767 Jan-12-2022, 12:31 AM
Last Post: buzzdarkyear
  How to crop eyes/nose/mouth in the face only? [OpenCV] buzzdarkyear 0 2,119 Jan-11-2022, 01:41 PM
Last Post: buzzdarkyear
  Face detector project? korenron 2 2,073 Mar-24-2021, 03:43 PM
Last Post: korenron
  Loop face landmarking in all folder using dlib lokoprof 5 2,849 Apr-17-2020, 10:08 AM
Last Post: deanhystad
  Object Detection that records the number of secs the face is not detected trabis03 1 2,515 Jul-21-2017, 04:14 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020