All models

HifiFace

A face swapping generator that uses a 3D shape-aware identity vector and learned face masks for blending.

Diffusion and generative · 1,031 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

This diagram has 1,031 operations (1.2 MB) and is drawn when you ask.

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
145.6M
Operations
1,031
Framework
PyTorch
Recurrent
Yes
Published
IJCAI 2021
Cited by
137 (as of 25 October 2026)
Authors
Yuhan Wang, Xu Chen, Junwei Zhu and others
License
BSD-3-Clause
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m17357
Graph hash
ce978d4c89ed6f0161df73915addec01182531f2770ca7ec0017166284c443d9
Skeleton hash
d7edd4d038ddd836153394c8a149d300aa853b5191d997bf0b25cb71a7ab7aec
Architecture hash
8cca522a99060a329622126213810637decbd4fa6a6c3a6615ae5260ea98db44
Diagram SHA-256
b602e7f06e320e8376e69997054f328828480c90d8da294801fe62e0e0addab1
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

HifiFace is a face swapping method: it generates an image with the identity of a source face and the attributes of a target image, such as pose, expression, lighting and background. Its particular aim is to keep the face shape of the source. The paper argues that a face recognition network, the usual source of identity information, focuses more on texture and is insensitive to geometric structure.

The pipeline has four parts: an encoder, a decoder, a 3D shape-aware identity extractor and a Semantic Facial Fusion (SFF) module. The identity extractor regresses the coefficients of the source and target faces with a 3D face reconstruction model, recombines them as shape information, and concatenates the result with the identity vector from a face recognition network. The SFF module integrates low-level encoder features and decoder features by learned adaptive face masks. At the image level, the network predicts a 3-channel image and a 1-channel mask and blends the image into the target by that mask.

This model comes from an unofficial implementation of the face swapping model proposed in the paper. It implements the 256x256 model, one of two versions the paper proposes. Its discriminator also differs from the paper's: it is the multi-scale discriminator from SPADE.

Key idea. HifiFace adds a 3D shape-aware identity, built from 3DMM coefficients and a face recognition vector, and a Semantic Facial Fusion module to preserve source face shape in face swapping.

  • HifiFace
  • face swapping
  • face swap
  • high fidelity face swapping
  • 3D shape-aware identity
  • Semantic Facial Fusion
  • SFF module
  • 3DMM

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{wang2021hififace3dshapesemantic,
      title={HifiFace: 3D Shape and Semantic Prior Guided High Fidelity Face Swapping}, 
      author={Yuhan Wang and Xu Chen and Junwei Zhu and Wenqing Chu and Ying Tai and Chengjie Wang and Jilin Li and Yongjian Wu and Feiyue Huang and Rongrong Ji},
      year={2021},
      eprint={2106.09965},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2106.09965}, 
}