diff --git a/modules/live_face_swapper.py b/modules/live_face_swapper.py index 83585c1..ebf506e 100644 --- a/modules/live_face_swapper.py +++ b/modules/live_face_swapper.py @@ -140,21 +140,21 @@ class LiveFaceSwapper: time.sleep(0.01) def _process_frame(self, frame: np.ndarray) -> np.ndarray: - """Simplified frame processing - back to basics to fix white screen issue""" + """Ultra-fast frame processing - maximum FPS priority""" try: - # Simple face detection and swapping without complex tracking + # Use the fastest face swapping method for maximum FPS if modules.globals.many_faces: many_faces = get_many_faces(frame) if many_faces: for target_face in many_faces: if self.source_face and target_face: - from modules.processors.frame.face_swapper import swap_face_enhanced - frame = swap_face_enhanced(self.source_face, target_face, frame) + from modules.processors.frame.face_swapper import swap_face + frame = swap_face(self.source_face, target_face, frame) else: target_face = get_one_face(frame) if target_face and self.source_face: - from modules.processors.frame.face_swapper import swap_face_enhanced - frame = swap_face_enhanced(self.source_face, target_face, frame) + from modules.processors.frame.face_swapper import swap_face + frame = swap_face(self.source_face, target_face, frame) return frame diff --git a/modules/processors/frame/face_swapper.py b/modules/processors/frame/face_swapper.py index ed468b9..abd6b81 100644 --- a/modules/processors/frame/face_swapper.py +++ b/modules/processors/frame/face_swapper.py @@ -100,17 +100,16 @@ def swap_face(source_face: Face, target_face: Face, temp_frame: Frame) -> Frame: def swap_face_enhanced(source_face: Face, target_face: Face, temp_frame: Frame) -> Frame: - """Enhanced face swapping with better quality and performance optimizations""" + """Fast face swapping - optimized for maximum FPS""" face_swapper = get_face_swapper() - # Apply the face swap + # Apply the face swap - this is the core operation swapped_frame = face_swapper.get( temp_frame, target_face, source_face, paste_back=True ) - # Enhanced post-processing for better quality - swapped_frame = enhance_face_swap_quality(swapped_frame, source_face, target_face, temp_frame) - + # Skip expensive post-processing to maintain high FPS + # Only apply mouth mask if specifically enabled if modules.globals.mouth_mask: # Create a mask for the target face face_mask = create_face_mask(target_face, temp_frame) @@ -470,7 +469,7 @@ def detect_obvious_occlusion(region: np.ndarray) -> np.ndarray: def process_frame(source_face: Face, temp_frame: Frame) -> Frame: - """Simplified process_frame - back to basics to fix white screen issue""" + """Ultra-fast process_frame - maximum FPS priority""" # Apply color correction if enabled if modules.globals.color_correction: @@ -481,13 +480,13 @@ def process_frame(source_face: Face, temp_frame: Frame) -> Frame: if many_faces: for target_face in many_faces: if source_face and target_face: - temp_frame = swap_face_enhanced(source_face, target_face, temp_frame) + temp_frame = swap_face(source_face, target_face, temp_frame) else: print("Face detection failed for target/source.") else: target_face = get_one_face(temp_frame) if target_face and source_face: - temp_frame = swap_face_enhanced(source_face, target_face, temp_frame) + temp_frame = swap_face(source_face, target_face, temp_frame) else: logging.error("Face detection failed for target or source.")