LatentSwap: An Efficient Latent Code Mapping Framework for Face Swapping
Changho Choi, Minho Kim, Junhyeok Lee, Hyoung-Kyu Song, Younggeun Kim, Seungryong Kim
TL;DR
LatentSwap tackles the inefficiency and data dependence of traditional face-swapping approaches by introducing a lightweight latent-code mixer that operates inside a pre-trained generator's latent space. The method trains on randomly sampled latent pairs and uses a pre-trained GAN inversion model at inference, enabling photorealistic, high-resolution swaps without additional datasets. The key contributions are the latent mixer architecture, a concise loss design with controllable trade-offs, and demonstrated applicability to 3D-aware generators like StyleNeRF, as well as downstream latent-space editing. This approach offers a practical, fast, and modular solution with broad potential for real-time applications and further 3D-aware extensions in face-related editing tasks.
Abstract
We propose LatentSwap, a simple face swapping framework generating a face swap latent code of a given generator. Utilizing randomly sampled latent codes, our framework is light and does not require datasets besides employing the pre-trained models, with the training procedure also being fast and straightforward. The loss objective consists of only three terms, and can effectively control the face swap results between source and target images. By attaching a pre-trained GAN inversion model independent to the model and using the StyleGAN2 generator, our model produces photorealistic and high-resolution images comparable to other competitive face swap models. We show that our framework is applicable to other generators such as StyleNeRF, paving a way to 3D-aware face swapping and is also compatible with other downstream StyleGAN2 generator tasks. The source code and models can be found at \url{https://github.com/usingcolor/LatentSwap}.
