Source-linked AI summary

Editing in Style: Uncovering the Local Semantics of GANs

Edo Collins, Raja Bala, Bob Price, Sabine Süsstrunk

arXiv:2004.14367v2cs.CVcs.LG

TL;DR

GAN image synthesis has advanced, but controlling and interpreting generated outputs remains limited. Focusing on StyleGAN, the paper introduces local semantic part transfer through style-vector manipulation between GAN-generated reference and target images. The method relies on learned semantic disentanglement and achieves naturalistic, localized edits without external supervision or complex spatial operations.

  • Problem

    GANs produce high-quality images, but their learned models are not straightforwardly interpretable and output control remains limited.

  • Method

    The method transfers semantically localized style from a reference GAN image to a target image using a global style operation guided by disentangled object representations.

  • Results

    The analysis finds that generator activation clusters correspond well to coherent semantic objects and parts, supporting localized editing.

  • Takeaways & Limitations

    StyleGAN’s learned semantic structure can support realistic local part editing without external segmentation supervision or complex spatial operations.

  • Takeaways & Limitations

    Further improvement in localization may require explicitly incorporating editing capabilities into adversarial training to strengthen disentanglement.

Abstract

from arXiv · show

While the quality of GAN image synthesis has improved tremendously in recent years, our ability to control and condition the output is still limited. Focusing on StyleGAN, we introduce a simple and effective method for making local, semantically-aware edits to a target output image. This is accomplished by borrowing elements from a source image, also a GAN output, via a novel manipulation of style vectors. Our method requires neither supervision from an external model, nor involves complex spatial morphing operations. Instead, it relies on the emergent disentanglement of semantic objects that is learned by StyleGAN during its training. Semantic editing is demonstrated on GANs producing human faces, indoor scenes, cats, and cars. We measure the locality and photorealism of the edits produced by our method, and find that it accomplishes both.

1. Introduction

GANs produce increasingly realistic images, but their learned models remain difficult to interpret and control. This paper identifies semantic disentanglement in StyleGAN and uses it for localized part transfer without external supervision or complex spatial processing.

  • Motivation and contribution: GANs have become dominant in data-driven image synthesis, while the exact models they learn for the data remain difficult to interpret.Progressive training encourages different layers to model variation at corresponding image resolutions.
  • Motivation and contribution: StyleGAN learns representations in which semantic objects and parts can vary substantially independently from the rest of the synthesized scene.Examples include mouths in faces and pillows in bedrooms.
  • Motivation and contribution: The paper introduces spatially localized semantic editing by transferring localized style from a reference GAN image to a target GAN image.The method primarily targets StyleGAN outputs and performs a local change through a global operation.
  • Motivation and contribution: The authors provide insight into StyleGAN’s hidden activations, showing that learned representations are largely disentangled with respect to semantic objects in synthesized images.This observation underlies the proposed editing method.
  • Motivation and contribution: The editor achieves naturalistic semantic part transfer without supervision from additional models or training data and without complex spatial processing.It relies on the semantic representation learned by the GAN itself.

2. Related Work

Prior GAN editing methods support either global latent-space changes or local activation manipulations. The proposed approach performs local editing in latent code space while avoiding external segmentation supervision and complex spatial blending.

  • Existing approaches: Existing GAN editing methods divide into latent code-based techniques for global attribute editing and activation-based techniques for local editing.The distinction concerns whether edits traverse latent manifolds or directly manipulate spatial activation positions.
  • Existing approaches: Latent code-based methods enable global changes such as color, lighting, pose, facial expression, age, hair, and eyewear.Some variants use autoencoders to disentangle images into semantic subspaces.
  • Existing approaches: Activation-based methods manipulate spatial generator activations, using segmentation supervision or activation copying to control or transfer objects.The paper compares feature blending and Poisson blending with its approach.
  • Proposed distinction: Unlike these approaches, the proposed method is latent code-based but performs local editing by exploiting disentanglement in the generator’s embedding space.It avoids external segmentation supervision and complex spatial blending operations.
  • Proposed distinction: The method differs from face-swapping work by editing localized semantic object parts rather than exchanging global facial properties.Its goal is editing synthesized content, not privacy-preserving de-identification.

3. Local Semantics in Generative Models

The paper finds that StyleGAN’s hidden activations organize into semantic objects and parts, enabling localized edits through global style-vector operations. The query vector selects channels associated with a region, while sequential selection improves localization without spatial blending.

  • 3.1. Feature factorization: Spherical k-means clustering of generator activations reveals coherent semantic objects and parts, including facial features and bedroom objects.Clusters are computed from activation vectors and can be aligned across generator layers through resampling.
  • 3.1. Feature factorization: Channel contributions to semantic clusters are computed from cluster memberships, producing a matrix that identifies each channel’s effect on each object or part.The contribution matrix is bounded between 0 and 1 under the stated feature-map normalization assumption.
  • 3.2.2 Conditioned interpolation: Given target and reference GAN outputs, style coefficients are interpolated so the reference appearance transfers selectively into a specified target object or part.The method uses a positive semi-definite matrix, implemented as a diagonal query vector, to control channel-wise interpolation.
  • 3.2.3 Choosing the query: For local editing, the query favors channels affecting the region of interest while suppressing channels with effects outside it.Using semantic-cluster contributions to set channel weights localizes interpolation while retaining a global style operation.
  • 3.2.3 Choosing the query: Compared with blending methods, the approach transfers styles across unaligned or differently scaled images and preserves more natural GAN appearance during localized edits.The cited examples include viewpoint changes in bedrooms and pose or scale differences in faces.
  • 3.2.3 Choosing the query: The sequential query improves localization by assigning maximum slope to the most relevant channels first and adding others only within an outside-ROI budget.Channels are ranked by cluster relevance, and irrelevant channels are excluded using a threshold condition.

4. Experiments

Experiments evaluate the method across face, bedroom, cat, and car GAN outputs, measuring locality and photorealism. The results show localized, perceptible edits, strong locality from the sequential approach, and preserved baseline-like photorealism, with limits in faithful appearance transfer and automated evaluation.

  • Experimental setup: Experiments use StyleGAN generators trained on FFHQ faces and LSUN-Bedrooms, with additional StyleGAN2 results on cats and cars.The FFHQ dataset contains 70K facial images, while LSUN-Bedrooms contains about 3M bedroom images.
  • Experimental setup: The first 32 × 32 generator layer is selected as the most semantic layer for spherical k-means clustering.The clustering layer is chosen for both datasets based on the observed semantic structure of generator representations.
  • Qualitative evaluation: Feature-level and Poisson blending are strictly localized but can lack photorealism, whereas the proposed method primarily affects the ROI while retaining baseline GAN photorealism.The method permits necessary global changes, which helps with misalignment between unaligned target and reference faces.
  • Locality: The sequential approach achieves the best trade-off between high In-MSE and low Out-MSE on both FFHQ and LSUN-Bedrooms.In-MSE measures change inside the ROI, while Out-MSE measures change outside it across query and interpolation settings.
  • Locality: MSE heatmaps over 50K FFHQ-StyleGAN samples show perceptible, localized transfers, with eyes and mouths more localized than noses.Nose edits induce a subtle correlation with other face parts, indicating that semantic parts are not equally disentangled.
  • Photorealism: FID scores indicate that edited images are not significantly different from vanilla baseline GAN outputs, but FID also gives the same result for feature blending despite visible photorealism defects.This exposes the difficulty of assessing perceived photorealism automatically; comparisons were also limited because feature blending does not support unaligned bedroom pairs.

5. Conclusion

The method leverages StyleGAN’s spatial disentanglement for localized semantic part editing, while leaving room for improved localization through training-time editing objectives and extension to real images.

  • 5. Conclusion: StyleGAN’s latent representations spatially disentangle semantic objects and parts, enabling localized semantic part editing.The method uses latent object representations to guide style interpolation without introducing artifacts beyond those inherent to StyleGAN.
  • 5. Conclusion: Future adversarial-training objectives could improve semantic-object disentanglement and yield better localization.
  • 5. Conclusion: The method can in principle edit real images by first mapping natural images into StyleGAN’s latent space.The paper identifies applications including photo enhancement, augmented reality, plastic-surgery visualization, and privacy preservation.

Appendix

A hidden feature vector at one spatial position corresponds to an image patch, with lower-resolution layers representing larger pixel-space regions.

  • Appendix: A vector at one hidden feature-map position corresponds to a whole patch in the RGB image.
  • Appendix: Lower hidden-layer resolution corresponds to a larger patch in pixel space.
  • Appendix: The spatial scale of hidden activations therefore determines the pixel-space extent represented by each vector.

A. Spherical k-means for semantic clustering

The semantic-clustering analysis treats hidden activations as patch embeddings, clusters them with spherical k-means, and reshapes memberships into spatial masks that reveal semantic concepts at suitable layers.

  • A. Spherical k-means for semantic clustering: At hidden layer L, activations form a batch tensor with C-channel feature maps of spatial size H × W.
  • A. Spherical k-means for semantic clustering: Each vector at one spatial location acts as a patch embedding representing a corresponding image patch.
  • A. Spherical k-means for semantic clustering: Spherical k-means clusters flattened patch embeddings by cosine similarity without encoding spatial position or sample identity.
  • A. Spherical k-means for semantic clustering: Cluster memberships can be reshaped into K sets of spatial masks, one mask per image and cluster.
  • A. Spherical k-means for semantic clustering: At suitable layers, such as StyleGAN’s 32 × 32 layer 6, activations capture concepts including eyes in faces and pillows in bedrooms.Clusters are selected through qualitative inspection, manual labeling, and occasional mask merging in a one-time offline process that drives automated editing.

B. Squared-error maps

Squared-error difference maps quantify changes between edited outputs and target images in CIELAB color space and are shown for selected qualitative examples.

  • B. Squared-error maps: Squared-error diff maps detect changes between edited outputs and the target image to evaluate edit locality.
  • B. Squared-error maps: The method computes these errors in CIELAB color space.
  • B. Squared-error maps: Figures 13 and 14 display diff maps corresponding to Figures 3 and 4.

C. Additional qualitative results with StyleGAN2

Additional StyleGAN2 examples extend the qualitative evaluation across FFHQ, LSUN-Cats, and LSUN-Cars, with accompanying difference maps. The maps illustrate that edits generally remain focused on the object of interest, although GAN-learned correlations can produce unintended changes elsewhere.

  • Additional StyleGAN2 results: Figures 15 and 17 extend earlier qualitative results with StyleGAN2, while Figures 19 and 20 show StyleGAN2 results on FFHQ.Additional examples are available through the paper’s GitHub page.
  • Layer-wise cluster maps: Spherical k-means cluster membership maps visualize layer-specific clusters for FFHQ-StyleGAN, LSUN-Bedroom-StyleGAN, CelebA-HQ-ProgGAN, and LSUN-Bedroom-ProgGAN.Color assignments are arbitrary for each layer.
  • Edit locality: Difference maps show that editing is primarily focused on the object of interest, with subtle changes elsewhere in the scene.This observation is reported for the edited outputs shown in Figure 3.
  • Edit locality: GAN-learned correlations can cause unintentional changes, such as altering a wall picture when the bed is edited.The corresponding mean-squared error maps are shown for Figure 4.
  • Additional StyleGAN2 results: StyleGAN2 local editing is demonstrated on LSUN-Cats and LSUN-Cars.Figures 15 and 17 present the editing results; Figures 16 and 18 provide their corresponding difference maps.
Loading 2004.14367v2…