# [StyleSpace Analysis: Disentangled Controls for StyleGAN Image Generation](https://arxiv.org/pdf/2011.12799.pdf)
The authors analyse the latent space of StyleGAN2 and propose a manipulation method on the Stylespace termed as *S*.
### Latent Space Disentanglement:
**Latent Spaces :**
- The the StyleGAN2 generation has number of latent spaces.
- The latent space *Z* ,distribution from which noise is sampled, is typically from normal distribution.
- These are transformed into intermediate latent space *W* by fully connected layers.
- Some works use *W+* where different intermediate vactors are fed into generator layers.
- The stylespace *S* is spanned by channel wise style parameters achieved by transformation of *W* using learned affine transformation in each layer of the generator.

**Disentanglement :**
- The author analyses which latent space offers most disentangled representation using DCI(disentanglement / completeness / informativeness).
- Disentanglement measures the degree to which each latent dimension captures at most one attribute, completeness measures the degree to which each attribute is controlled by at most one latent dimension, while informativeness measures the classification accuracy of the attributes, given the latent representation.
- *S* has higher score of DCI, meaning each dimension of *S* is more likely to control a single attribute and vice versa.
### Local-Active Style Channel:
- The author propose a method to detect Stylespace channels that control the visual appearance of local semantic regions.
- The gradient map of generated images are examimen with respect to different channels and the overlap of them with specific semantic region is measured.
- If the overlap is consistent over large number of images, channel is identified as locally-active for overlapped semantic region.

### Attribute-specific Style Channel:
- The attribute specific style channels are calculated in a simple manner, normalisation is done using the mean and standard deviation of generated distribution over the style vector(mean) of positive examples to find the difference.
- For each style channel the deviation is taken and its relevance it measure with respect to target attribute as a ratio, higher the ratio more likely it controls target attribute.

- Unlike other approaches this approach requires very few positive examples to control channels.
### Disentangled Attribute Manipulation:
- The individual attributes are manipulated along small step sizes in a way the amount of change the logit changes in all different models is same.
- These models are compared using the Attribute Dependency(AD) metric
- Attribute Dependency measures the degree to which manipulation along a certain direction induces changes in other attributes, as measured by classifiers for those attributes.


### Manipulation of real images:
- To manipulate real images they need to be inverted into latent codes, this is done by a Latent operation algorithm.
- It is observed the latent optimisation flexibility of *S* is most followed by *W+* and then *W*.
- More flexibility enables closer reconstruction of imput image but this results in latent codes which do not lie on generated image manifold and can create unnatural artifacts.
- So conversely to flexibility manipulation naturalness is most on *W* follwed by *W+* and then *S*.
- To have proper results the paper trains an encoder to encode *S* using only reconstruction loss(LPIPS).
- The reconstructed image bear good similarity to input but have few compression artifacts