TypeError: process_frame() got an unexpected keyword argument 'detected_faces' when using GPEN-256 / GPEN-512 face enhancers in live webcam mode
Description
In live webcam mode, enabling the GPEN-BFR-256 or GPEN-BFR-512 face enhancer causes the processing thread to crash with a TypeError. The GFPGAN-1024 enhancer works fine — only the two new GPEN enhancers are affected.
Steps to reproduce
- Run on Apple Silicon (M4) with
python run.py --execution-provider coreml - Select a source face and click Live (webcam mode)
- In the GUI, enable Face Enhancer GPEN-256 (or GPEN-512)
- The processing thread immediately crashes
Traceback
Exception in thread Thread-4 (_processing_thread_func): Traceback (most recent call last): File ".../threading.py", line 1045, in _bootstrap_inner self.run() File ".../threading.py", line 982, in run self._target(*self._args, **self._kwargs) File ".../modules/ui.py", line 1167, in _processing_thread_func temp_frame = frame_processor.process_frame( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: process_frame() got an unexpected keyword argument 'detected_faces'
Root cause
Signature mismatch between the live-mode caller in ui.py and the GPEN processors:
modules/ui.py:1167andmodules/ui.py:1171call the GPEN enhancers withdetected_faces=_cached_faces:temp_frame = frame_processor.process_frame( None, temp_frame, detected_faces=_cached_faces)
But modules/processors/frame/face_enhancer_gpen256.py:85 and face_enhancer_gpen512.py:85 define: def process_frame(source_face: Face | None, temp_frame: Frame) -> Frame: — no detected_faces parameter. Only modules/processors/frame/face_enhancer.py:386 (GFPGAN-1024) accepts detected_faces, which is why GFPGAN-1024 works but the GPEN variants don't.
The GPEN processors were introduced in commit e57116d ("feat: add GPEN-BFR 256 and 512 ONNX face enhancers") and weren't updated to match the live-mode caller's calling convention.
Suggested fix Either:
Update process_frame in face_enhancer_gpen256.py and face_enhancer_gpen512.py to accept and use a detected_faces parameter (mirroring face_enhancer.py), or Make ui.py conditionally pass detected_faces only to processors that accept it. Environment macOS (Apple Silicon, M4) Python 3.11.15 onnxruntime-silicon 1.16.3 Repo HEAD: e34d204 (latest main as of filing) Execution provider: coreml
Source: hacksider/Deep-Live-Cam