Shafeek Saleem commited on
Commit
16b122a
·
1 Parent(s): a81dca2

bug fixed - image readnhj

Browse files
pages/2_Face Detection and Creating Database.py CHANGED
@@ -81,7 +81,7 @@ def step2_page():
81
  face_image = image[top:bottom, left:right]
82
  pil_image = Image.fromarray(face_image)
83
  col.image(pil_image, use_column_width=True)
84
- face_name = st.text_input('Specify name', "This is a placeholder", key="text_"+str(i))
85
  if st.button("Save", key="button_"+str(i)):
86
  img_name = str(uuid.uuid4()) + f"_{face_name}_{i}" + ".jpg"
87
  img_path = os.path.join(img_dir, img_name)
 
81
  face_image = image[top:bottom, left:right]
82
  pil_image = Image.fromarray(face_image)
83
  col.image(pil_image, use_column_width=True)
84
+ face_name = st.text_input('Specify name to save it in the known-face database', "This is a placeholder", key="text_"+str(i))
85
  if st.button("Save", key="button_"+str(i)):
86
  img_name = str(uuid.uuid4()) + f"_{face_name}_{i}" + ".jpg"
87
  img_path = os.path.join(img_dir, img_name)
pages/3_Face Encodings.py CHANGED
@@ -59,13 +59,9 @@ def step3_page():
59
  if len(images) > 0:
60
  for i, img in enumerate(images):
61
  face_image = face_recognition.load_image_file(os.path.join(img_dir, img))
62
- st.image(face_image)
63
- my_face_encoding_ = face_recognition.face_encodings(face_image)
64
- st.write("test 1")
65
- my_face_encoding = face_recognition.face_encodings(face_image)[0]
66
- st.write("test 2")
67
  my_bar.progress(int((i + 1) / len(images) * 100), text="Generating face encodings...")
68
- face_encodings_dict[img.split("_")[1]] = my_face_encoding
69
  my_bar.progress(100, text="Successfully encoded all the known faces!")
70
  st.success("Face encoding completed successfully!")
71
  with open(os.path.join(".sessions", get_login()["username"], "face_encodings.json"), "w") as write_file:
 
59
  if len(images) > 0:
60
  for i, img in enumerate(images):
61
  face_image = face_recognition.load_image_file(os.path.join(img_dir, img))
62
+ my_face_encoding = face_recognition.face_encodings(face_image)
 
 
 
 
63
  my_bar.progress(int((i + 1) / len(images) * 100), text="Generating face encodings...")
64
+ face_encodings_dict[img.split("_")[1]] = my_face_encoding.tolist()
65
  my_bar.progress(100, text="Successfully encoded all the known faces!")
66
  st.success("Face encoding completed successfully!")
67
  with open(os.path.join(".sessions", get_login()["username"], "face_encodings.json"), "w") as write_file: