Spaces:
Runtime error
Runtime error
Shafeek Saleem
commited on
Commit
·
3acfa00
1
Parent(s):
2736c78
added face encodings page dhk
Browse files- pages/3_Face Encodings.py +1 -2
- pages/4_Face Recognition.py +4 -5
pages/3_Face Encodings.py
CHANGED
|
@@ -62,8 +62,7 @@ def step3_page():
|
|
| 62 |
face_image = face_recognition.load_image_file(os.path.join(img_dir, img))
|
| 63 |
my_face_encoding = face_recognition.face_encodings(face_image)
|
| 64 |
my_bar.progress(int((i + 1) / len(images) * 100), text="Generating face encodings...")
|
| 65 |
-
|
| 66 |
-
np.save(f, my_face_encoding)
|
| 67 |
# face_encodings_dict[img.split("_")[1]] = my_face_encoding.tolist()
|
| 68 |
my_bar.progress(100, text="Successfully encoded all the known faces!")
|
| 69 |
st.success("Face encoding completed successfully!")
|
|
|
|
| 62 |
face_image = face_recognition.load_image_file(os.path.join(img_dir, img))
|
| 63 |
my_face_encoding = face_recognition.face_encodings(face_image)
|
| 64 |
my_bar.progress(int((i + 1) / len(images) * 100), text="Generating face encodings...")
|
| 65 |
+
np.save(os.path.join(".sessions", get_login()["username"], "face_encodings",img.split("_")[1]+".npy"), my_face_encoding)
|
|
|
|
| 66 |
# face_encodings_dict[img.split("_")[1]] = my_face_encoding.tolist()
|
| 67 |
my_bar.progress(100, text="Successfully encoded all the known faces!")
|
| 68 |
st.success("Face encoding completed successfully!")
|
pages/4_Face Recognition.py
CHANGED
|
@@ -37,11 +37,10 @@ def step4_page():
|
|
| 37 |
known_face_names = []
|
| 38 |
if len(face_encodings) > 0:
|
| 39 |
for i, face_encoding in enumerate(face_encodings):
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
known_face_names.append(face_name)
|
| 45 |
|
| 46 |
while True:
|
| 47 |
# Grab a single frame of video
|
|
|
|
| 37 |
known_face_names = []
|
| 38 |
if len(face_encodings) > 0:
|
| 39 |
for i, face_encoding in enumerate(face_encodings):
|
| 40 |
+
known_face_encoding = np.load(os.path.join(face_encodings_dir, face_encoding))
|
| 41 |
+
face_name = img.split(".")[0]
|
| 42 |
+
known_face_encodings.append(known_face_encoding)
|
| 43 |
+
known_face_names.append(face_name)
|
|
|
|
| 44 |
|
| 45 |
while True:
|
| 46 |
# Grab a single frame of video
|