This is a HeadSwap project, mainly inspired by HeSer.Pytorch
It includes two stages
- One stage deeply copy from PIRender
- The other stage is from HeSer.Pytorch
Fix enviroment bug!!!
Colab notebooks:
the pictures is from 小红书 and baidu
super resolution -> CF-Net
face parsing -> face-parsing.PyTorch
3dmm -> Deep3DFaceRecon_pytorch
- envrionment
cuda 11.7,torch1.13.1LVT in this project is follow hereconda create -n headswap python==3.10.12 conda activate headswap pip install -r requirements.txt
- download model
a. follow Deep3DFaceRecon_pytorch(https://github.com/sicxu/Deep3DFaceRecon_pytorch#prepare-prerequisite-models), download BFM files and epoch_20.pth in pretrained_models
b. follow PIRender, put epoch_00190_iteration_000400000_checkpoint.pt to pretrained_models
c.files like this:cd process bash download_weight.sh
pretrained_models/ ├── BFM │ ├── 01_MorphableModel.mat │ └── similarity_Lm3D_all.mat ├── Blender-401-00012900.pth ├── epoch_00190_iteration_000400000_checkpoint.pt ├── epoch_20.pth ├── parsing.pth └── sr_cf.onnx
- run
# set your own image path in inference.py python inference.py
HeSer.Pytorch model and implementation: https://github.com/LeslieZhoa/HeSer.Pytorch Copyright © 2022,LeslieZhoa License https://github.com/LeslieZhoa/HeSer.Pytorch/blob/main/LICENSE
PIRender model and implementation: https://github.com/RenYurui/PIRender Copyright © 2021,RenYurui. License https://github.com/RenYurui/PIRender/blob/main/LICENSE.md
CF-Net model and implementation: https://github.com/ytZhang99/CF-Net Copyright © 2021,ytZhang99.
Deep3DFaceRecon_pytorch model and implementation: https://github.com/sicxu/Deep3DFaceRecon_pytorch Copyright © 2021,sicxu. License https://github.com/sicxu/Deep3DFaceRecon_pytorch/blob/master/LICENSE
arcface pytorch model pytorch model and implementation: https://github.com/ronghuaiyang/arcface-pytorch Copyright © 2018, ronghuaiyang.
LVT model and implementation: https://github.com/LeslieZhoa/LVT Copyright © 2022, LeslieZhoa.
face-parsing model and implementation: https://github.com/zllrunning/face-parsing.PyTorch Copyright © 2019, zllrunning. License https://github.com/zllrunning/face-parsing.PyTorch/blob/master/LICENSE