mirror of
https://github.com/facefusion/facefusion.git
synced 2026-04-26 11:26:41 +02:00
Temp fix for shaking face
This commit is contained in:
@@ -65,12 +65,13 @@ def pre_check() -> bool:
|
||||
def extract_faces(frame : Frame) -> List[Face]:
|
||||
face_detector = get_face_analyser().get('face_detector')
|
||||
faces: List[Face] = []
|
||||
temp_frame = resize_frame_dimension(frame, 640, 640)
|
||||
temp_frame = resize_frame_dimension(frame, 1024, 1024)
|
||||
temp_frame_height, temp_frame_width, _ = temp_frame.shape
|
||||
frame_height, frame_width, _ = frame.shape
|
||||
ratio_height = frame_height / temp_frame_height
|
||||
ratio_width = frame_width / temp_frame_width
|
||||
face_detector.setScoreThreshold(0.5)
|
||||
face_detector.setNMSThreshold(0.5)
|
||||
face_detector.setTopK(100)
|
||||
face_detector.setInputSize((temp_frame_width, temp_frame_height))
|
||||
with THREAD_SEMAPHORE:
|
||||
@@ -84,7 +85,7 @@ def extract_faces(frame : Frame) -> List[Face]:
|
||||
(detection[0:4][0] + detection[0:4][2]) * ratio_width,
|
||||
(detection[0:4][1] + detection[0:4][3]) * ratio_height
|
||||
]
|
||||
kps = (detection[4:14].reshape((5, 2)) * [[ ratio_width, ratio_height ]]).astype(int)
|
||||
kps = (detection[4:14].reshape((5, 2)) * [[ ratio_width, ratio_height ]])
|
||||
score = detection[14]
|
||||
embedding = calc_embedding(frame, kps)
|
||||
normed_embedding = embedding / numpy.linalg.norm(embedding)
|
||||
|
||||
Reference in New Issue
Block a user