8000 Error showing Please install `face_recognition_models` with this command before using `face_recognition . · Issue #1634 · ageitgey/face_recognition · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Error showing Please install face_recognition_models with this command before using `face_recognition . #1634
Open
@Ujjwalgupta13

Description

@Ujjwalgupta13

I am facing the issue in my face recognition attendance system project it show the error continously after installing many times:

Please install face_recognition_models with this command before using face_recognition:

pip install git+https://github.com/ageitgey/face_recognition_models

This is my code:

import face_recognition
import cv2
import numpy as np
import csv
from datetime import datetime

video_capture=cv2.VideoCapture(0)

#Load Known faces

ujjwal_image=face_recognition.load_image_file("faces/ujjwal.jpg")

ujjwal_encoding=face_recognition.face_encodings(ujjwal_image)[0]

aditya_image=face_recognition.load_image_file("faces/aditya.jpg")
aditya_encoding=face_recognition.face_encodings(aditya_image)[0]

known_face_encodings=[ujjwal_encoding,aditya_encoding]
known_face_names=["Ujjwal","Aditya"]

#List of expected students
students=known_face_names.copy()

face_locations=[]
face_encodings=[]

now=datetime.now()
current_date=datetime.strftime("%Y-%M-%D")

f=open(f"{current_date}.csv","w+",newline="")
lnwriter=csv.writer(f)

while True: #Infinite while loop
_ frame = video_capture.read()
small_frame= cv2.resize(frame, (0,0), fx=0.25 , fy=0.25)

rgb_small_frame= cv2.cvtColor(small_frame,cv2.COLOR_BGR2RGB)

#Recognize faces
face_locations=face_recognition.face_locations(rgb_small_frame)
face_encodings=face_recognition.face_encodings(rgb_small_frame,face_locations)


for face_encoding in face_encodings:
    matches=face_recognition.compare_faces(known_face_encodings) 
    face_distance=face_recognition.face_distance(known_face_encodings,face_encoding)
    best_match_index = np.argmin(face_distance) 

    if(matches[best_match_index]):   # Agr ye true hai 
        name=known_face_names[best_match_index] 
        

cv2.imshow("Attendance", frame)   
if cv2.waitKey(1) &  0xFF == ord("q"):
    break

video_capture.release()
cv2.destroyAllWindows()
f.close()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0