Shafeek Saleem commited on
Commit
2028549
1 Parent(s): 2b5e9d0

face recog fixed

Browse files
Files changed (1) hide show
  1. pages/4_Face Recognition.py +5 -2
pages/4_Face Recognition.py CHANGED
@@ -30,6 +30,7 @@ def step4_page():
30
  )
31
  face_encodings_dir = os.path.join(".sessions", get_login()["username"], "face_encodings")
32
  face_encodings = os.listdir(face_encodings_dir)
 
33
  known_face_encodings = []
34
  known_face_names = []
35
  if len(face_encodings) > 0:
@@ -38,7 +39,8 @@ def step4_page():
38
  face_name = face_encoding.split(".")[0]
39
  known_face_encodings.append(known_face_encoding)
40
  known_face_names.append(face_name)
41
-
 
42
  st.info("Select an image to analyze!")
43
  input_type = st.radio("Select the Input Type", ["Image", "Camera"])
44
 
@@ -57,10 +59,11 @@ def step4_page():
57
  st.image(image)
58
  st.info("Select the tolerance level you want for your model! (How much distance between faces to consider it a match. "
59
  "Lower is more strict. 0.6 is typical best performance.)")
60
- tolerance = st.slider('Select tolerance level', 0.0, 1.0, 0.6, 0.1)
61
  if tolerance:
62
  for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings):
63
  # See if the face is a match for the known face(s)
 
64
  matches = face_recognition.compare_faces(known_face_encodings, face_encoding, tolerance=tolerance)
65
 
66
  name = "Unknown"
 
30
  )
31
  face_encodings_dir = os.path.join(".sessions", get_login()["username"], "face_encodings")
32
  face_encodings = os.listdir(face_encodings_dir)
33
+ st.write(face_encodings)
34
  known_face_encodings = []
35
  known_face_names = []
36
  if len(face_encodings) > 0:
 
39
  face_name = face_encoding.split(".")[0]
40
  known_face_encodings.append(known_face_encoding)
41
  known_face_names.append(face_name)
42
+ st.write(known_face_encodings)
43
+ st.write(known_face_names)
44
  st.info("Select an image to analyze!")
45
  input_type = st.radio("Select the Input Type", ["Image", "Camera"])
46
 
 
59
  st.image(image)
60
  st.info("Select the tolerance level you want for your model! (How much distance between faces to consider it a match. "
61
  "Lower is more strict. 0.6 is typical best performance.)")
62
+ tolerance = st.slider('Select tolerance level', 0.0, 1.0, 0.3, 0.1)
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
  matches = face_recognition.compare_faces(known_face_encodings, face_encoding, tolerance=tolerance)
68
 
69
  name = "Unknown"