Source-linked AI summary

Image2StyleGAN++: How to Edit the Embedded Images?

Rameen Abdal, Yipeng Qin, Peter Wonka

arXiv:1911.11544v2cs.CVcs.GR

TL;DR

Image2StyleGAN++ addresses limitations in embedding photographs into GAN latent spaces, especially restoring high-frequency details and supporting local control. It extends Image2StyleGAN with noise optimization, masked local embeddings, and activation tensor manipulation, achieving reconstructions of up to 45 dB versus about 20 dB previously and enabling diverse editing applications.

  • Problem

    Existing GAN image embeddings have limited reconstruction fidelity and global latent-space control for local image editing.

  • Method

    Image2StyleGAN++ combines sequential W + and noise-space optimization, masked embeddings, and activation tensor manipulation.

  • Results

    Up to 45 dB PSNR is reported for faithful reconstructions, compared with about 20 dB for previous best results, alongside multiple image-editing applications.

  • Takeaways & Limitations

    The framework supports reconstruction, inpainting, crossover, scribble-based editing, local style transfer, and attribute-level feature transfer.

  • Takeaways & Limitations

    Inpainting still poorly learns some lighting conditions, age, and skin colors.

Abstract

from arXiv · show

We propose Image2StyleGAN++, a flexible image editing framework with many applications. Our framework extends the recent Image2StyleGAN in three ways. First, we introduce noise optimization as a complement to the $W^+$ latent space embedding. Our noise optimization can restore high-frequency features in images and thus significantly improves the quality of reconstructed images, e.g. a big increase of PSNR from 20 dB to 45 dB. Second, we extend the global $W^+$ latent space embedding to enable local embeddings. Third, we combine embedding with activation tensor manipulation to perform high-quality local edits along with global semantic edits on images. Such edits motivate various high-quality image editing applications, e.g. image reconstruction, image inpainting, image crossover, local style transfer, image editing using scribbles, and attribute level feature transfer. Examples of the edited images are shown across the paper for visual inspection.

1. Introduction

Image2StyleGAN++ extends Image2StyleGAN with noise optimization, local masked embeddings, and activation tensor manipulation for high-quality image editing applications.

  • Contributions: Noise space optimization restores high-frequency image features and improves reconstruction PSNR from about 20 dB to up to 45 dB.The method complements latent-space optimization with noise optimization to recover details that latent optimization cannot reproduce.
  • Contributions: Masked W + embeddings support local modifications, including missing regions and approximately specified colors such as user scribbles.The embedding seeks plausible content outside masks while filling masked pixels with reasonable semantic content.
  • Contributions: Combining embedding with activation tensor manipulation enables high-quality local edits alongside global semantic edits.This combination forms the third technical extension of the framework.
  • Applications: The framework is applied to image reconstruction, inpainting, crossover, local style transfer, scribble-based editing, and attribute-level feature transfer.The authors report that these applications can support development of state-of-the-art image editing software.

2. Related Work

The related work situates Image2StyleGAN++ within GAN image synthesis, latent-space embedding, and activation tensor manipulation for visual editing and analysis.

  • GANs: GANs have supported applications including object detection, texture synthesis, image-to-image translation, and video generation.These applications build on improvements in GAN architecture, loss functions, and regularization.
  • Latent Space Embedding: Image embedding generally uses either an encoder network or optimization of a latent code to match the input image.Encoder methods historically offered higher-quality results but have an inherent generalization problem beyond the training dataset.
  • Latent Space Embedding: Abdal et al. improved embedding quality by optimizing latent codes in the enhanced W + space.Image2StyleGAN++ extends this recent embedding approach.
  • Activation Tensor Manipulation: Activation tensor manipulation uses generator internals to analyze GAN capabilities and perform semantic edits such as adding, removing, or changing image content.The approach relies on locating and manipulating relevant neurons or activation tensors with fixed network weights.

3. Overview

Image2StyleGAN++ combines masked W + and noise-space embedding with activation tensor operations to support local and global image-editing applications.

  • Embedding: The extended embedding algorithm uses spatial masks for incomplete images and approximate color guidance, and layer masks to restrict optimization to selected layers.The overview identifies early StyleGAN layers with content and later layers with style.
  • Activation Tensor Manipulation: The framework directly manipulates activation tensors through spatial copying, channel-wise copying, and averaging.
  • Optimization Strategies: Joint optimization compares perceptual-plus-pixel loss with pixel-only loss and noise resampling across alternative embedding configurations.
  • Applications: Alternating optimization and other embedding settings serve as common building blocks for constructing image-editing applications.The framework combines multiple embedding and direct-manipulation steps.
  • Applications: The applications include improved reconstruction, image crossover, inpainting, scribble-based local edits, local style transfer, and attribute-level feature transfer.

4. An Extended Embedding Algorithm

The extended embedding algorithm jointly represents images with semantically meaningful W^+ variables and high-frequency Noise variables, using masked optimization and alternating updates. Noise optimization substantially improves reconstruction fidelity, while joint or repetitive alternating optimization is unsuitable or ineffective for editing quality.

  • Embedding formulation: The algorithm embeds target RGB images using W^+ variables for semantic information and Noise variables for high-frequency details.The generic embedding uses a pre-trained generator and gradient-based optimization to produce an embedded code (w, n).
  • Objective function: The objective combines pixel-wise MSE, perceptual, and style losses, with spatial masks controlling their application.The masks are applied through Hadamard products, and perceptual loss uses multiple VGG-16 layers.
  • Reconstruction quality: 39 to 45 dB PSNR is obtained with W^+ and Noise embedding, compared with 19 to 22 dB for W^+ embedding alone.Figure 4 compares original images with reconstructions from the two embedding configurations.
  • Optimization strategies: Joint optimization can replace image details with high-frequency artifacts, while pixel-only optimization stores too much information in Noise and harms editability.The authors therefore do not recommend joint optimization for the embedding representation.

5. Activation Tensor Manipulations

The framework edits embedded images by manipulating StyleGAN activation tensors at selected layers. It supports spatial copying, averaging, and channel-wise copying, with spatial copying performing somewhat better in the authors’ tests.

  • Activation tensors: Activation tensors are taken from selected StyleGAN layers after embedding an image with its W^+ and Noise variables.The tensors are defined as layer outputs initialized from the embedded image variables.
  • Editing operations: Spatial copying combines regions from two activation tensors to transfer corresponding image parts.Figure 5 contrasts naive half-image copying with the output of the extended embedding algorithm.
  • Editing operations: Channel-wise copying forms a new activation tensor from selected channels of one tensor and the remaining channels of the other.Averaging is another supported tensor operation.
  • Comparison: Spatial copying works a bit better than averaging and channel-wise copying in the authors’ tests.

6. Frequently Used Building Blocks

The paper packages masked latent, Noise, style, and activation operations into reusable building blocks. Masks determine which image regions, layers, or variables are optimized or manipulated.

  • Masking: Binary masks wm and nm select which W^+ and Noise variables are updated, while spatial masks control loss terms.A mask value of 1 indicates variables to update and 0 indicates variables to keep constant.
  • Optimization blocks: Masked W^+ optimization updates W^+ while keeping Noise fixed, using a masked loss and either Adam or gradient descent.The implementation uses Adam with learning rate 0.01 or gradient descent with learning rate 0.8, depending on the application.
  • Optimization blocks: Masked Noise Optimization updates Noise variables while keeping W^+ fixed, using MSE terms without perceptual loss.The specified loss weights are λs = 0, λmse1 = 10^-5, λmse2 = 10^-5, and λp = 0.
  • Style transfer: Masked Style Transfer optimizes W^+ toward a target style image using a style-loss term.Its style-loss weight is λs = 5×10^-7, with the other listed loss weights set to zero.
  • Activation operations: Masked activation tensor operations apply generator transformations to activation tensors from two images, with masks resized to each tensor’s resolution.The masks use nearest-neighbor interpolation to match the activation tensor dimensions.

7. Applications

The framework supports improved reconstruction and several localized editing applications by optimizing W^+ latents and noise, using masks, and manipulating activation tensors.

  • 7.1. Improved Image Reconstruction: Image reconstruction optimizes W^+ latents followed by noise to recover high-fidelity images and high-frequency features.The method uses 5000 W^+ iterations and 3000 noise-optimization iterations, reaching PSNR scores of 44 to 45 dB.
  • 7.2. Image Crossover: Image crossover embeds masked regions from two images with blurred masks, then applies noise optimization to blend source and target content.The blurred masks are formed by convolving binary masks with Gaussian filters to blend boundaries.
  • 7.3. Image Inpainting: Image inpainting uses early W^+ layers to predict missing content and later layers to maintain color consistency, followed by masked noise optimization.Different initializations can produce different inpainting solutions, while results are reported as comparable with partial convolution and free of its regular artifacts.
  • 7.5. Local Style Transfer: Local style transfer combines masked W^+ optimization, masked style transfer, and masked noise optimization within a blurred region.The procedure modifies a region of an input image according to a style reference image.
  • 7.6. Attribute level feature transfer: Attribute-level feature transfer copies selected intermediate activation-tensor values between two embedded images, allowing independently localized edits.The operation manipulates tensors at the output of StyleGAN’s fourth layer and uses a mask to select copied values.

8. Conclusion

Image2StyleGAN++ extends Image2StyleGAN with noise optimization, masked local embeddings, and activation tensor manipulation. The framework supports high-quality reconstruction and diverse local and global image-editing applications, with future work targeting video editing.

  • Conclusion: Noise maps capture high-frequency image features, improving the quality of reconstructed images.This is presented as the first key insight motivating the framework.
  • Conclusion: Masks in the embedding algorithm enable local edits and increase the framework’s image-editing capability.This is presented as the second key insight.
  • Conclusion: Combining embedding with activation tensor manipulation creates a variety of image-editing applications.This is presented as the third key insight.
  • Conclusion: The authors conclude that Image2StyleGAN++ is a promising framework for general image editing and aim to extend it from static images to videos.The video extension is identified as future work.

9. Additional Results

Additional evaluations show that Image2StyleGAN++ performs strongly on challenging inpainting, supports flexible outputs, and enables local attribute transfer with perceptually smooth results, while some inpainting attributes remain imperfect.

  • Image Inpainting: The method is evaluated against Partial Convolution and Gated Convolution using SSIM, MSE, and PSNR at three image resolutions.The evaluation uses seven masks and ten diverse ground-truth images to create defective images with large missing regions.
  • Image Inpainting: Image2StyleGAN++ outperforms both comparison methods across all reported inpainting metrics and remains visually stronger when missing regions cover about half the image.Partial Convolution fails in this setting, while Gated Convolution fills details at lower quality than the proposed method.
  • Image Inpainting: The framework can generate different high-perceptual-quality inpainting results from different wini initializations.This flexibility is illustrated by the evaluation using different initializations.
  • Image Crossover: Noise-space crossover combines parts of images from different races, demonstrating additional expressive capacity for image crossover.The comparison includes naive half-image copying and the framework’s generated two-face result.
  • Attribute Level Feature Transfer: Attribute-level feature transfer supports independently interpolating attributes from different embedded images while preserving high blending quality across faces, cars, and bedrooms.For LSUN Bedrooms, bed style and position can be customized without changing the room layout.
  • Attribute Level Feature Transfer: Masked interpolation on FFHQ has lower perceptual length than non-masked interpolation, suggesting less drastic changes and comparable perceptual quality.LSUN Cars and LSUN Bedrooms have relatively higher scores because feature positions and orientations can vary, making blending less effective.
Loading 1911.11544v2…