fixed multi-faces recognition

This commit is contained in:
2026-09-25 08:50:28 +02:00
parent 27fc43fcbb
commit 0ab66b5352
3 changed files with 44 additions and 9 deletions
+8 -3
View File
@@ -9,6 +9,7 @@ from face_recognition import *
files = list_all_files("./data/raw", ["jpg", "webp"])
# process each files
faces = []
for file_path in files:
filename = file_path.split("/")[-1].split(".")[0]
@@ -18,12 +19,16 @@ for file_path in files:
if img is None:
print(f"ERROR: Could not read image at {file_path}")
continue
cv2.imshow("image1", img)
# detect faces file
faces = detect_face_in_image(img, scale=1)
faces_data = detect_face_in_image(img, scale=1)
print("faces_data: ", faces_data[1])
# extract faces from file
extract_faces(faces, img, filename)
faces += extract_faces(faces_data, img, filename)
# classify each faces
for face in faces:
face.save("./data/extracted")
cv2.destroyAllWindows()