HS-Diffusion: Learning a Semantic-Guided Diffusion Model for Head Swapping

Qinghe Wang, Lijie Liu, Miao Hua, Qian He, Pengfei Zhu, Bing Cao, Qinghua HuarXiv 2022 · DOI

TL;DR

HS-Diffusion is a two-stage framework for high-fidelity head swapping. It utilizes a semantic layout generator to create an anatomically correct blueprint and a Latent Diffusion Model (LDM) with a progressive fusion strategy to seamlessly blend source head and body details while synthesizing a natural neck transition.

Introduction

Head swapping—replacing an entire head including hair and neck—presents unique challenges compared to standard face swapping. It requires preserving the distinct features of the source head and target body while "hallucinating" a seamless physiological transition (the neck) that exists in neither source. Furthermore, the lack of paired datasets (the same person with different heads) makes supervised training impossible. Existing methods often struggle with geometric realism, leading to "floating heads" or mismatched skin tones. HS-Diffusion addresses these issues by operating in a semantic-guided latent space.

Methodology

The HS-Diffusion pipeline consists of two primary components designed to ensure both geometric accuracy and high-quality texture synthesis.

1. Semantic Layout Generator ($G_{layout}$)

To solve the data scarcity problem, the model first works with semantic parsing maps. $G_{layout}$ takes the head layout from the source and the body layout from the target, blends them, and inpaints the missing neck region. This provides a coarse-grained geometric blueprint that ensures anatomical correctness before any pixels are generated.

2. Semantic-Mixing LDM

The core innovation is the Semantic-Mixing Latent Diffusion Model. Unlike standard diffusion models that start from pure noise, this model employs a progressive fusion strategy. At each denoising step $t$, the model mixes the noised latents of the source head ($z_t^H$) and source body ($z_t^B$) with the current denoised latent of the transition region. This mixing is strictly guided by the inpainted semantic layout masks ($m^H, m^B$).

The HS-Diffusion inference pipeline, illustrating how source head and body latents are mixed with the denoised transition region under semantic guidance.

3. Training and Alignment

  • Semantic Calibration: To train without paired data, the authors use "head-cover augmentation." By randomly removing the neck/body from a single person's layout and forcing the model to reconstruct it, the LDM learns to realistically inpaint physiological connections.
  • Neck Alignment: A plug-and-play geometric fix aligns the horizontal centers of the source head and body, preventing broken silhouettes or misaligned necklines.

Experiments and Results

The authors evaluated HS-Diffusion on a reprocessed version of the SHHQ-1.0 dataset (Stylish-Humans-HQ), creating a new benchmark for half-body head swapping.

Quantitative Performance

HS-Diffusion significantly outperforms state-of-the-art inpainting and editing models. On the SHHQ256 benchmark, it achieved an FID of 11.24, a nearly 30% improvement over the next best competitor, MAT (FID 16.11). The authors also introduced Mask-FID and Focal-FID to specifically measure the quality of the synthesized transition regions.

Qualitative Evaluation

The model demonstrates exceptional ability in handling complex hairstyles, accessories (like hats and sunglasses), and varying skin tones. By resampling the transition region to match the source head's tone, it achieves natural results even in cross-skin-tone swaps.

Qualitative results of HS-Diffusion across various source heads and bodies, demonstrating seamless transitions and preservation of accessories.

Conclusion

HS-Diffusion represents a significant step forward in image-based head swapping. By leveraging semantic layouts as an intermediate bridge and employing a progressive latent mixing strategy, it overcomes the hurdles of data scarcity and geometric misalignment. While inference speed remains a challenge due to the iterative nature of diffusion, the framework's ability to produce seamless, anatomically correct swaps sets a new standard for the field.

Summary updated

BibTeX
@misc{wang2022hs,
  author = {Qinghe Wang and Lijie Liu and Miao Hua and Qian He and Pengfei Zhu and Bing Cao and Qinghua Hu},
  title = {{HS-Diffusion: Learning a Semantic-Guided Diffusion Model for Head Swapping}},
  year = {2022},
  eprint = {2212.06458},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.06458},
}
Figure