diff --git a/yoona_target.py b/yoona_target.py index 642d86d..55635af 100644 --- a/yoona_target.py +++ b/yoona_target.py @@ -1,6 +1,5 @@ import base64 from io import BytesIO - import cv2 import face_recognition import numpy as np @@ -42,13 +41,16 @@ def yoona_test(video_path): group_encodings = [enc for _, enc in face_group] avg_encoding = np.mean(group_encodings, axis=0) dist = np.linalg.norm(avg_encoding - encoding) - if dist < 0.6: # 같은 사람으로 판단하는 임계값 + if dist < 0.555: # 같은 사람으로 판단하는 임계값 face_group.append((face_images[idx], encoding)) matched = True break if not matched: identified_faces.append([(face_images[idx], encoding)]) + # 얼굴 수가 많은 순서로 그룹 정렬 + identified_faces.sort(key=lambda x: len(x), reverse=True) + video_capture.release() print('end1') @@ -81,4 +83,5 @@ def save_faces(identified_faces): # 모든 인물의 인코딩된 이미지를 배열에 추가 face_base64_arrays.append(encoded_faces) - return face_base64_arrays \ No newline at end of file + return face_base64_arrays +