From 31de5fde57184d05bb091b8d6c13f64eeeaf518f Mon Sep 17 00:00:00 2001 From: henryruhs Date: Mon, 29 May 2023 15:47:57 +0200 Subject: [PATCH] Skip processing if there is no face, print output to console --- core/processor.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/processor.py b/core/processor.py index 112fd71..c851b0a 100644 --- a/core/processor.py +++ b/core/processor.py @@ -14,9 +14,14 @@ def process_video(source_img, frame_paths): frame = cv2.imread(frame_path) try: face = get_face(frame) - result = face_swapper.get(frame, face, source_face, paste_back=True) - cv2.imwrite(frame_path, result) + if face: + result = face_swapper.get(frame, face, source_face, paste_back=True) + cv2.imwrite(frame_path, result) + print('.', end='', flush=True) + else: + print('S', end='', flush=True) except Exception as e: + print('E', end='', flush=True) pass