You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to build a face recognition software for my college project work , but I have issues in face_recognition module it shows error having no atribute . Kindly help me I need to do this for my graduation
What I Did
import cv2
import numpy as np
import face_recognition_models
import face_recognition as fr
video_capture = cv2.VideoCapture(0)
image = fr.load_image_file('boy.jpg')
image_face_encoding = fr.face_encodings (image)[0]
known_face_encodings = [image_face_encoding]
known_face_names = ["sidhartha"]
while True:
ret, frame = video_capture.read()
rgb_frame = frame[:, :, ::-1]
fc_locations = fr.face_locations(rgb_frame)
fc_enodings = fr.face_encodings(rgb_frame, fc_locations)
for(top, right, bottom, left), face_encoding in zip(fc_locations, face_encodings):
mathces = fr.compare_faces(known_face_encodings, face_encoding)
name= "unknown"
fc_distances = fr.face_distances(known_face_encodings, face_encoding)
match_index = np.argmin(fc_distances)
if matches[match_index]:
name = known_face_names[match_index]
cv2.rectangle(frame, (left, top), (right, bottom), (0,0,225), 2)
cv2.rectangle(frame, (left, botttom - 35), (right, bottom), (0,0,255), cv2.FILLED)
font = cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(frame, name, (left +6, bottom - 6), font, 1.0, (255, 255, 255), 1)
cv2.imshow('simplilearn face detection system', frame)
if cv2.waitKey(1) & 0xff == ord('q'):
break
video_capture.release()
cv2.destroyAllWindows()
output.
Traceback (most recent call last):
File "C:/Users/ASUS/sid.py", line 3, in <module>
import face_recognition
File "C:\Users/ASUS\face_recognition.py", line 7, in <module>
image = fr.load_image_file('boy.jpg')
AttributeError: module 'face_recognition_models' has no attribute 'load_image_file'
The text was updated successfully, but these errors were encountered:
For what it's worth, I had similar issues and downgrading to python-3.11 allowed the face_recognition module to work. I haven't had time to look into "why" yet.
Description
I was trying to build a face recognition software for my college project work , but I have issues in face_recognition module it shows error having no atribute . Kindly help me I need to do this for my graduation
What I Did
The text was updated successfully, but these errors were encountered: