https://github.com/ai-forever/ghost-2.0
A new one shot head swapping approach
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.6%) to scientific vocabulary
Keywords
Repository
A new one shot head swapping approach
Basic Info
Statistics
- Stars: 92
- Watchers: 4
- Forks: 14
- Open Issues: 8
- Releases: 1
Topics
Metadata Files
README.md
GHOST 2.0: Generative High-fidelity One Shot Transfer of Heads
We present GHOST 2.0, a novel approach for realistic head swapping. Our solution transfers head from source image to the target one in a natural way, seamessly blending with the target background and skin color.
While the task of face swapping (see our GHOST model) has recently gained attention in the research community, a related problem of head swapping remains largely unexplored. In addition to skin color transfer, head swap poses extra challenges, such as the need to preserve structural information of the whole head during synthesis and inpaint gaps between swapped head and background. We address these concerns with GHOST 2.0, which consists of two problem-specific modules. First, we introduce a new Aligner model for head reenactment, which preserves identity information at multiple scales and is robust to extreme pose variations. Secondly, we use a Blender module that seamlessly integrates the reenacted head into the target background by transferring skin color and inpainting mismatched regions. Both modules outperform the baselines on the corresponding tasks, allowing to achieve state-of-the-art results in head swapping. We also tackle complex cases, such as large difference in hair styles of source and driver. For more details on our solution, please refer to the paper.
Installation
Install conda environment: ``` conda create -n ghost python=3.10
pip install face-alignment pip install facenet_pytorch
conda config --add channels conda-forge conda config --set channel_priority strict pip install -U 'git+https://github.com/facebookresearch/fvcore' conda install pytorch3d -c pytorch3d-nightly
pip install -r requirements.txt
python -m pip uninstall numpy
python -m pip install numpy==1.23.1
Clone the following repositories in therepos``` folder. Download respective checkpoints:
For EMOCA, download ResNet50 folder from here and unpack into repos/emoca/gdl_apps/EmotionRecognition/ and assets/EmotionRecognition/image_based_networks/
Download the models from releases. Place them into the following folders ``` - alignercheckpoints - aligner1020gazefinal.ckpt - blendercheckpoints - blenderlama.ckpt
src
- losses
- gaze_models
- losses
weights
- backbone50_1.pth
- vgg19-d01eb7cb.pth
- segformerB5ce.onnx ```
Inference
For inference use inference.ipynb or run
python inference.py --source ./examples/images/hab.jpg --target ./examples/images/elon.jpg --save_path result.png
Training
- Download VoxCeleb2. We expect the following structure of data directory and assume images are stored in BGR format: ```
- train
- person_id
- video_folder -h5 video files -test ```
- person_id
- Preprocess data according to the example in file
preprocess_image.py - To train Aligner, run
python train_aligner.py - To train Blender, run
python train_blender.py
Citation
If you find our method useful in your research, please consider citing
@misc{groshev2025ghost2
title={GHOST 2.0: generative high-fidelity one shot transfer of heads},
author={Alexander Groshev and Anastasiia Iashchenko and Pavel Paramonov and Denis Dimitrov and Andrey Kuznetsov},
year={2025},
eprint={2502.18417},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2502.18417},
}
Ethics
Deep fake synthesis methods have been improved a lot in quality in recent years. The research solutions were wrapped in easy-to-use API, software and different plugins for people with a little technical knowledge. As a result, almost anyone is able to make a deepfake image or video by just doing a short list of simple operations. At the same time, a lot of people with malicious intent are able to use this technology in order to produce harmful content. High distribution of such a content over the web leads to caution, disfavor and other negative feedback to deepfake synthesis or head swap research.
As a group of researchers, we are not trying to denigrate celebrities and statesmen or to demean anyone. We are computer vision researchers, we are engineers, we are activists, we are hobbyists, we are human beings. To this end, we feel that it's time to come out with a standard statement of what this technology is and isn't as far as us researchers are concerned.
GHOST 2.0 is not for creating inappropriate content. GHOST 2.0 is not for changing heads without consent or with the intent of hiding its use. GHOST 2.0 is not for any illicit, unethical, or questionable purposes. GHOST 2.0 exists to experiment and discover AI techniques, for social or political commentary, for movies, and for any number of ethical and reasonable uses. We are very troubled by the fact that GHOST 2.0 can be used for unethical and disreputable things. However, we support the development of tools and techniques that can be used ethically as well as provide education and experience in AI for anyone who wants to learn it hands-on. Now and further, we take a zero-tolerance approach and total disregard to anyone using this software for any unethical purposes and will actively discourage any such uses.
Acknowledgements
This work utilizes code from the follwing repositories:
Neural Head Reenactment with Latent Pose Descriptors
EMOPortraits: Emotion-enhanced Multimodal One-shot Head Avatars
RT-GENE: Real-Time Eye Gaze Estimation in Natural Environments
Owner
- Name: AI Forever
- Login: ai-forever
- Kind: organization
- Location: Armenia
- Repositories: 60
- Profile: https://github.com/ai-forever
Creating ML for the future. AI projects you already know. We are non-profit organization with members from all over the world.
GitHub Events
Total
- Issues event: 8
- Watch event: 85
- Issue comment event: 10
- Push event: 3
- Fork event: 15
Last Year
- Issues event: 8
- Watch event: 85
- Issue comment event: 10
- Push event: 3
- Fork event: 15
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Anastasia Yaschenko | 4****o | 27 |
| icml2025-11779 | i****9 | 19 |
| AlexanderGroshev | a****v@g****m | 5 |
| ThunderstormXX | i****r@y****u | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 5 months ago
All Time
- Total issues: 14
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: about 1 hour
- Total issue authors: 11
- Total pull request authors: 1
- Average comments per issue: 0.86
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 14
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: about 1 hour
- Issue authors: 11
- Pull request authors: 1
- Average comments per issue: 0.86
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- MadeByKit (3)
- Vivaansharma2003 (2)
- GrenKain (1)
- Pudge-tao (1)
- Monish021 (1)
- TonyDua (1)
- jasam-sheja (1)
- JQminded (1)
- luoxyhappy (1)
- alanashton-elite (1)
- ak3389 (1)
Pull Request Authors
- Pikassik (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- adabound ==0.0.5
- chumpy ==0.70
- diffusers ==0.24.0
- einops ==0.8.0
- h5py ==3.12.1
- huggingface-hub ==0.25.0
- imgaug ==0.4.0
- insightface ==0.7.3
- kornia ==0.8.0
- lightning ==2.5.0.post0
- lpips ==0.1.4
- matplotlib ==3.10.0
- mediapipe ==0.10.21
- omegaconf ==2.3.0
- onnx ==1.17.0
- onnxruntime ==1.20.1
- pytorch-lightning ==2.5.0.post0
- pytorch-msssim ==1.0.0
- scikit-image ==0.25.1
- simple-lama-inpainting ==0.1.2
- torchfile ==0.1.0
- torchmetrics ==1.6.1
- transformers ==4.48.2
- wandb ==0.19.6