Skip to content

Commit

Permalink
yoona_target
Browse files Browse the repository at this point in the history
# 내림차순 / 10 프레임
  • Loading branch information
YooonaKim authored May 17, 2024
1 parent 7daa148 commit cc86448
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions yoona_target.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import base64
from io import BytesIO

import cv2
import face_recognition
import numpy as np
Expand Down Expand Up @@ -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')

Expand Down Expand Up @@ -81,4 +83,5 @@ def save_faces(identified_faces):
# 모든 인물의 인코딩된 이미지를 배열에 추가
face_base64_arrays.append(encoded_faces)

return face_base64_arrays
return face_base64_arrays

0 comments on commit cc86448

Please sign in to comment.