Skip to content

Swap faces with AI from a source image to a destination medium. Img2Img, Img2GIF, & Img2MP4

Notifications You must be signed in to change notification settings

thebiglaskowski/faceoff

Repository files navigation

Faceoff

Img2Image - Img2GIF - Img2MP4

Swap faces from a source image to a destination medium. Each app runs independelty in it's own Gradio instance for ease of use.

Read more at https://thebiglaskowski.com/posts/face-swapping-with-ai

Demo: Faceoff Img2MP4 vs DeepFaceLab Deepfake

Faceoff on the left, DeepFaceLab on the right

Faceoff.Img2MP4.VS.DeepFaceLab.Comparison.mp4

Installation

Dependencies

  1. FFmpeg

Download and install FFmpeg

  1. CUDA >= 10.1

Download and install CUDA

  1. Requirements
git clone https://github.com/thebiglaskowski/faceoff.git
cd faceoff
conda create -n faceoff python=3.8 -y
conda activate faceoff
pip install torch==1.11.0+cu115 torchvision==0.12.0+cu115 -f https://download.pytorch.org/whl/torch_stable.html

# If not using CodeFormer enhancement use this torch & torchvision version instead

pip install torch==2.0.0+cu118 -f https://download.pytorch.org/whl/torch_stable.html torchvision==0.15.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html

pip install -r requirements.txt
  1. Download the inswapper_128.onnx model from Hugging Face and place it in the root directory of this project.

Usage

Faceoff Img2Img

python faceoff.py

http://127.0.0.1:5000/

Faceoff Img2GIF

python faceoff_gif.py 

http://127.0.0.1:5001/

Faceoff Img2MP4

python faceoff_video.py

http://127.0.0.1:5002/

Demo: Faceoff Img2MP4 - Basic vs Enhanced (w/CodeFormer)

Basic on the left, Enhanced on the right

Faceoff.Img2MP4.Basic.vs.Enhanced.Comparison.mp4

Sarah Connor?

Watch the video

To Do

  • Add Enhanced version of Img2GIF
  • Add Enhanced version of Img2MP4
  • Develop controls to manage multiple faces (source/destination)

Special Thanks To

About

Swap faces with AI from a source image to a destination medium. Img2Img, Img2GIF, & Img2MP4

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published