executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
deep-live-camReal-time face swap and video deepfake using a single source image. Use when: building face-swap applications, real-time video effects, virtual try-on features, AI video effects pipelines.
Independent GitHub snapshot · Automated classification · Original documentation governs
Real-time face swap and video deepfake using a single source image. Supports webcam, video files, and streaming with GPU acceleration. The pipeline detects faces, extracts embeddings, swaps faces using the inswapper model, and post-processes with GFPGAN/CodeFormer for quality.
Source: hacksider/Deep-Live-Cam
git clone https://github.com/hacksider/Deep-Live-Cam.git
cd Deep-Live-Cam
pip install -r requirements.txt
Download models into the models/ directory:
mkdir -p models
wget -O models/inswapper_128_fp16.onnx "https://huggingface.co/hacksider/deep-live-cam/resolve/main/inswapper_128_fp16.onnx"
For GPU acceleration:
pip install onnxruntime-gpu # NVIDIA CUDA
pip install onnxruntime-rocm # AMD ROCm
pip install onnxruntime-coreml # Apple Silicon
GUI mode (webcam, real-time):
python run.py
CLI mode — process a video file:
python run.py \
--source path/to/source_face.jpg \
--target path/to/target_video.mp4 \
--output path/to/output.mp4 \
--execution-provider cuda
CLI mode — process a single image:
python run.py \
--source path/to/source_face.jpg \
--target path/to/target_image.jpg \
--output path/to/output.jpg
--mouth-mask--face-mapping--enhancer gfpganpython run.py \
--source speaker_headshot.jpg \
--target conference_talk.mp4 \
--output anonymized_talk.mp4 \
--execution-provider cuda \
--enhancer gfpgan
This replaces the speaker's face in a 45-minute conference recording with the source face, using GPU acceleration and GFPGAN enhancement for broadcast-quality output.
import cv2
import insightface
from insightface.app import FaceAnalysis
app = FaceAnalysis(name="buffalo_l", providers=["CUDAExecutionProvider"])
app.prepare(ctx_id=0, det_size=(640, 640))
swapper = insightface.model_zoo.get_model(
"models/inswapper_128_fp16.onnx",
providers=["CUDAExecutionProvider"]
)
source_img = cv2.imread("actor_headshot.jpg")
target_img = cv2.imread("movie_scene_frame.jpg")
source_faces = app.get(source_img)
target_faces = app.get(target_img)
if source_faces and target_faces:
result = swapper.get(target_img, target_faces[0], source_faces[0], paste_back=True)
cv2.imwrite("swapped_scene.jpg", result)
python run.py --mouth-mask --execution-provider cuda
Launches the GUI with webcam input. Select a source face image, enable mouth mask for natural lip sync, and start the live face swap at 25-30 FPS on an RTX 3060.