Unofficial implementation of the paper: StyleSwap: Style-Based Generator Empowers Robust Face Swapping
This repo is mainly to re-implement the face swap paper based on stylegan
- Linux or macOS
- NVIDIA GPU + CUDA CuDNN
- Python 3
- Clone the repository:
git clone https://github.com/MingtaoGuo/StyleSwap.git
cd StyleSwap
- Dependencies:
We recommend running this repository using Anaconda. All dependencies for defining the environment are provided inenvironment.yaml
.
-
Download the face parsing model from faceparsing
-
Download the face recognition model arcface from insightface Go to Baidu Drive -> arcface_torch -> glint360k_cosface_r50_fp16_0.1 -> backbone.pth
-
Generate face mask by faceparsing
python face_parsing/face_parsing.py --img_dir face_dataset --res_dir face_mask_dataset --resolution 256 --model_path saved_models/79999_iter.pth
- Train StyleSwap
python train_simple.py --img_path face_dataset --mask_path face_mask_dataset --arcface saved_models/backbone.pth
- Pretrained model is coming soon!
Mingtao Guo E-mail: gmt798714378 at hotmail dot com
[1]. Xu, Zhiliang, et al. "StyleSwap: Style-Based Generator Empowers Robust Face Swapping." arXiv preprint arXiv:2209.13514 (2022).