This repository contains code to implement an end-to-end pipeline for swapping faces from images and videos using classical and deep learning approach.
Inbuilt library dlib is used which is based on SVM face detector.
- Set input1 and input 2 as the required source and destination paths in Wrapper.py main. Note:
- If the two inputs are the same video, set input1 as video path and input2 as None
- If one input is a video and the other an image, set input1 as video path and input2 as image path
- Set method as "TRI" for triangulation or "TPS" for Thin Plate Spline algorithms respectively.
- Run Wrapper.py using
python3 Wrapper.py
- Download the model weight from https://drive.google.com/file/d/1UoE-XuW1SDLUjZmJPkIZ1MLxvQFgmTFH/view
- Place the file in ./PRNet/Data/net-data
- Create a conda environment or venv with python2.7, tf 1.13 (gpu version), cv2 4.2.1, numpy and dlib.
- In prnetWrapper.py, specify path to the source image/video and path to the destination image/video.
- Run in command line:
python prnetWrapper.py
.