ReStyle encoder (iterative residual W+ inversion, one refinement step)
A StyleGAN inversion encoder that refines its latent code by predicting a residual at each step.
Diffusion and generative · 536 operations Checked
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
- 205.6M
- Operations
- 536
- Framework
- PyTorch
- Recurrent
- No
- Published
- ICCV 2021
- Cited by
- 310 (as of 23 October 2026)
- Authors
- Yuval Alaluf, Or Patashnik, Daniel Cohen-Or
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m2464
- Graph hash
- 0b0eb3640b10a558a1e6a28324ef139d9a23ec623e0cf2219f737591171e6600
- Skeleton hash
- 84a55d41e4280db3aca6629a1bcad3acd6ac4f18ddafb5a32da5dc20c8ac33ed
- Architecture hash
- c7732d4a531ac6b776f37e85d04f09b432af453a628e7196c433f2b4e6f30f17
- Diagram SHA-256
- bc795378c449c8394368512c60ca862a316e347f266549918a496393c306e2ec
- 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
This model is the ReStyle encoder for a single refinement step: it takes the input image concatenated with the current reconstruction and predicts a residual latent code.
ReStyle is an encoder for StyleGAN inversion: finding the latent code of a trained GAN that corresponds to a given real image, which is what makes it possible to manipulate real images with the GAN. Earlier encoders predict that code directly in a single pass. ReStyle instead predicts a residual with respect to the current estimate of the latent code and repeats the step, so the inversion corrects itself over a few iterations.
The scheme is initialized with the average latent code. At each step the encoder receives the input image concatenated with the image for the current estimate, predicts a residual latent code, and that residual is added to the previous latent code. Passing the updated code through the generator gives a new reconstruction, which becomes the input of the following step.
The paper applies the scheme to two existing encoders, pSp and e4e. It uses a simplified encoder architecture in which all style vectors are extracted from the final 16 × 16 feature map. All ReStyle encoders in the paper are trained using N = 5 steps per batch. The paper reports improved accuracy over the encoder-based methods it compares against, with a negligible increase in inference time.
Key idea. ReStyle extends encoder-based StyleGAN inversion with iterative refinement, having the encoder predict a residual to the current latent estimate instead of the full code in one pass.
- ReStyle
- ReStyle encoder
- ReStyle-pSp
- ReStyle-e4e
- StyleGAN inversion
- GAN inversion
- residual-based StyleGAN encoder
- iterative refinement
- W+ latent code
- encoder bootstrapping
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{alaluf2021restyleresidualbasedstyleganencoder,
title={ReStyle: A Residual-Based StyleGAN Encoder via Iterative Refinement},
author={Yuval Alaluf and Or Patashnik and Daniel Cohen-Or},
year={2021},
eprint={2104.02699},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2104.02699},
}