8000 GitHub - usingcolor/LatentSwap: Official Implementation of LatentSwap:An Efficient Latent Code Mapping Framework for Face Swapping
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

usingcolor/LatentSwap

Repository files navigation

LatentSwap: An Efficient Latent Code Mapping Framework for Face Swapping

Notes

  • This code was primarily written in the summer of 2023.
  • The code was not tested before committing.
  • Contributions and pull requests are welcome.

Table of Contents

  1. Introduction
  2. Requirements and Installation
  3. Training
  4. Inference
  5. Results
  6. Evaluation and Performance Metrics
  7. Citation
  8. License
  9. Code Author

Introduction

Official Implementation for LatentSwap:An Efficient Latent Code Mapping Framework for Face Swapping.

Requirements and Installation

Run Docker Container

docker build . -t latentswap:latest

docker run -it --ipc host --gpus "device=0" -v /PATH_TO_SAVE:/DATA --name latentswap latentswap:latest

Pre-Trained Model for StyleGAN2

Download checkpoint from official checkpoint and copy it to '/workspace/' in docker container.

docker cp ffhq.pkl latentswap:/workspace/

Pre-Trained Model for Smooth Identity Embedder

Download checkpoint with this link and copy it to '/workspace' in docker container.

docker cp epoch=5-step=109999.ckpt latentswap:/workspace/

Pre-Trained Model for Deep3DFace PyTorch

Follow the guideline in Prepare prerequisite models at /workspace/model/Deep3DFaceRecon_pytorch/ folder.

docker cp latentswap:/workspace/model/Deep3DFaceRecon_pytorch/BMF/

docker cp epoch_20.pth latentswap:/workspace/model/Deep3DFaceRecon_pytorch/checkpoints

Training

python latentswap_trainer.py --help

Inference

Pre-trained Model

Download the pre-trained model from this link.

docker cp epoch=39-step=200000.ckpt latentswap:/workspace/

Inference with Target and Source Images

python pti_inversion_inference.py --model_checkpoint_path 'epoch=39-step=200000.ckpt' --target_image_path TARGET_PATH --source_image_path SOURCE_PATH

Ensure all images follow the preprocessing steps of FFHQ.

Results

FFHQ Test Set Results

FFHQ Test Set Results

Evaluation and Performance Metrics

Metric comparisons of our model on the FaceForensics++ dataset

Model ID ↑ Expression ↓ Pose ↓ Params ↓
DeepFakes 88.39 0.1705 13.38 Unknown
FaceShifter 90.68 0.1223 7.65 250M
SimSwap 89.73 0.0879 5.82 120M
HifiFace 98.48 NA 7.89 244M
MegaFS 90.83 0.1348 7.92 338M
RAFSwap 96.70 0.1312 7.59 Unknown
InfoSwap 99.67 0.1427 9.07 251M
Ours 93.36 0.0673 4.06 87M

Note: Our model achieves comparable performances to other face swapping models for ID and better performance for all other metrics.

Citation

Choi, Changho, et al. "LatentSwap: An Efficient Latent Code Mapping Framework for Face Swapping." arXiv preprint arXiv:2402.18351 (2024).

License

MIT License

Code Author

Changho Choi @ Korea Univ. (changho9808@gmail.com)

About

Official Implementation of LatentSwap:An Efficient Latent Code Mapping Framework for Face Swapping

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0