All Projects
Face Swiper — Production-Grade AI Face & Head Swap
0da4a396d-8f53-480d-9c04-641aab809028AI/ML · Computer Vision

Face Swiper — Production-Grade AI Face & Head Swap

Python · InsightFace (buffalo_l + inswapper) · ONNX Runtime · MediaPipe · OpenCV · GFPGAN · Flask

PythonPythonFlaskFlaskONNXONNXOpenCVOpenCVMediaPipeMediaPipe

Problem

Most face-swap demos break on real photos: visible seams, lost hairlines, mismatched skin tone, and no support for group shots or full-head transfer. A reliable, production-grade swapper was needed that preserves identity and context.

Solution

Built a two-mode pipeline. FACE mode swaps the face while preserving the subject's hairline and surrounding context; HEAD mode performs a full-head transfer. The system uses InsightFace (buffalo_l detector + inswapper) on ONNX Runtime for the core swap, MediaPipe segmentation to isolate regions, affine alignment for geometry, LAB colour matching for tone, and seamless blending to remove seams. GFPGAN restores and upscales facial detail in the final output. Supports group photos and a UI face picker.

Impact

A self-hosted, dependency-light alternative to paid face-swap APIs — runs on CPU/GPU, keeps user images private (nothing leaves the server), and produces sharp, seam-free results good enough for live event use. Powers the direct-swap modes inside the Rolac World Cup Photobooth.

AI face swaphead swap AIInsightFace inswapperONNX RuntimeGFPGAN face restorationcomputer vision engineerMediaPipe segmentationLAB color matchingseamless cloningdeepfake-style compositingproduction ML pipelineself-hosted face swap
Chat on WhatsApp