Shafeek Saleem commited on
Commit
9b42807
1 Parent(s): f8438df

face recog fixed

Browse files
Files changed (1) hide show
  1. pages/4_Face Recognition.py +6 -7
pages/4_Face Recognition.py CHANGED
@@ -63,17 +63,16 @@ def step4_page():
63
  if tolerance:
64
  for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings):
65
  # See if the face is a match for the known face(s)
66
- st.write(known_face_encodings)
67
- face_distances = face_recognition.face_distance(known_face_encodings, face_encoding)
68
  name = "Unknown"
 
 
 
 
69
  best_match_index = np.argmin(face_distances)
70
  if matches[best_match_index]:
71
  name = known_face_names[best_match_index]
72
- #
73
- # # If a match was found in known_face_encodings, just use the first one.
74
- # if True in matches:
75
- # first_match_index = matches.index(True)
76
- # name = known_face_names[first_match_index]
77
 
78
  face_image = image[top:bottom, left:right]
79
  pil_image = Image.fromarray(face_image)
 
63
  if tolerance:
64
  for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings):
65
  # See if the face is a match for the known face(s)
66
+ matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
67
+
68
  name = "Unknown"
69
+
70
+ # If a match was found in known_face_encodings, just use the first one.
71
+ face_distances = face_recognition.face_distance(known_face_encodings, face_encoding)
72
+ st.write(face_distances)
73
  best_match_index = np.argmin(face_distances)
74
  if matches[best_match_index]:
75
  name = known_face_names[best_match_index]
 
 
 
 
 
76
 
77
  face_image = image[top:bottom, left:right]
78
  pil_image = Image.fromarray(face_image)