1

Ok so I am trying to make a face recognition login system but I keep on getting the same error.

Here is my code:

import cv2
import pyttsx3
from deepface import DeepFace

def take_picture():
    print("Scanning Face...")
    cap = cv2.VideoCapture(0)
    ret, frame = cap.read()
    cv2.imwrite("img1.jpg", frame)
    cv2.destroyAllWindows()
    cap.release()
    print("Face Scan Complete")


take_picture()
img1 = "img1.jpg"
img2 = "Just Me.png"

model_name = "Facenet"

authentication = DeepFace.verify(img1_path=img1, img2_path=img2, model_name=model_name, enforce_detection=False)

# print(authentication['verified']):
if authentication['verified']:
    print("Access Granted")
else:
    print("Access Denied.")**

And here is the error i am getting:

Scanning Face... [ WARN:0@38.046] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (539) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback Face Scan Complete 1/1 [==============================] - 9s 9s/step Traceback (most recent call last): File "c:\Users\Admin\Desktop\JARVIS\JARVIS_FACE_RECOGNITION.py", line 30, in authentication = DeepFace.verify(img1_path=img1, img2_path=img2, model_name=model_name, enforce_detection=False) File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\deepface\DeepFace.py", line 170, in verify img2_representation = represent(img_path = img2_path File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\deepface\DeepFace.py", line 754, in represent img = functions.preprocess_face(img = img_path File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\deepface\commons\functions.py", line 175, in preprocess_face img = load_image(img) File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\deepface\commons\functions.py", line 90, in load_image raise ValueError("Confirm that ",img," exists") ValueError: ('Confirm that ', 'Just Me.png', ' exists')

F2Playz
  • 11
  • 2
  • "Just Me.png" is really in the same folder of that python program? If yes, try not to use blank character in the file such as "JustMe.png". – johncasey Nov 19 '22 at 20:55
  • thank you for responding, it was in the same directory and i tried using no blank characters but still did not work – F2Playz Mar 16 '23 at 10:10
  • i managed to fix the error but now the problem is it says access granted ti everyone :/ – F2Playz Mar 16 '23 at 10:20

0 Answers0