This repository is a production-grade face manipulation platform (facefusion). It operates as a modular monolith, combining a powerful CLI, a Gradio web UI, a job queue system, and a plugin-based processor architecture. The system ingests images or videos, detects faces using various ONNX models (RetinaFace, YOLO, etc.), and applies a configurable pipeline of processors (face swapping, enhancement, editing, age modification, lip-syncing, background removal, etc.). It relies heavily on ffmpeg for video/audio handling and ONNX Runtime for model inference. The architecture is exceptionally clean, with clear separation of concerns between the UI, CLI, workflows, jobs, and individual processors. It is not a research notebook or a simple script; it is a well-engineered application designed for end-to-end media processing, demonstrating high craftsmanship in state management, thread safety, and extensibility.
Deep-Live-Cam is a real-time face swapping desktop application that uses ONNX Runtime with insightface models to swap faces in live webcam feeds or pre-recorded images/videos. The core pipeline involves face detection (RetinaFace), face recognition (ArcFace), and a face swap model (inswapper_128), with optional face enhancement via GFPGAN or GPEN-BFR ONNX models. The application provides a PySide6 GUI for selecting source/target faces, toggling options (mouth mask, many faces, Poisson blending, sharpening, temporal interpolation), and managing camera selection. It supports multiple execution providers: CUDA (NVIDIA), CoreML (Apple Silicon), DirectML (AMD/Intel), OpenVINO (Intel), and CPU fallback. Video processing can run in-memory via FFmpeg pipes (avoiding disk I/O) or via traditional frame extraction to PNG files. The architecture is modular: frame processors (face swapper, enhancers) follow a common interface, and the codebase includes optimizations for Apple Silicon (CoreML subgraph optimization, Pad decomposition, Shape/Gather folding) and CUDA (IO binding, CUDA graphs). The project also includes a benchmark pipeline and unit tests for core components.