StyleGAN Latent Spaces: W and W+
You'll learn: How StyleGAN transforms the input noise into a more controllable intermediate latent space through its mapping network, and why this leads to better image manipulation.
From Z to W: The Mapping Network
In traditional GANs (like DCGAN), you sample a random noise vector Z (typically from a Gaussian distribution) and feed it directly into the generator. StyleGAN does something different: it first passes Z through a mapping network—an 8-layer fully-connected neural network—to produce an intermediate latent code W.
Think of Z as a jumbled dictionary where related concepts are scattered randomly. The mapping network untangles this dictionary, reorganizing it so that similar concepts sit near each other in W space.
Why W Is Better: Disentanglement
The key advantage of W is disentanglement. In Z space, changing one dimension might affect multiple features (hair color and face shape). In W space, individual dimensions are more likely to control separate, meaningful features independently.
Analogy: Z is like adjusting your TV with one dial that changes both brightness and color simultaneously. W gives you separate knobs for each property.
W+: Per-Layer Control
StyleGAN goes even further with W+ (W-plus). Instead of using the same W vector at every layer of the generator, W+ allows different W vectors for each layer. This gives fine-grained control: early layers control coarse features (pose, face shape), while later layers control fine details (hair texture, skin pores).
Key Takeaway: StyleGAN's mapping network transforms random noise Z into an intermediate latent space W with better disentanglement properties, and W+ extends this by allowing different latent codes per generator layer, enabling unprecedented control over generated images.