HyperNST: Hyper-Networks for Neural Style Transfer

Dan Ruta, Andrew Gilbert, Saeid Motiian, Baldo Faieta, Zhe Lin, John P. Collomosse

Introduction

Neural Style Transfer (NST) has traditionally forced a compromise between speed and quality. Feed-forward methods offer near-instantaneous results but often produce repetitive, "flat" styles. Conversely, optimization-based methods, such as StyleGAN-NADA, deliver high-quality and diverse artistic outputs but require several minutes of computation per image, rendering them impractical for interactive creative tools. Furthermore, most existing NST algorithms are exemplar-based, requiring a specific style image and making it difficult for artists to explore a continuous style space or apply localized styles.

HyperNST addresses these challenges by introducing a fast, controllable, and semantically aware framework. By utilizing a hyper-network to predict weight updates for a pre-trained StyleGAN2 model, HyperNST achieves high-fidelity artistic stylization with superior content preservation at real-time inference speeds.

Methodology

HyperNST integrates four primary components to bridge the gap between speed and stylistic flexibility:

  1. StyleGAN2 Backbone: Rather than training a generator from scratch, the framework utilizes a pre-trained StyleGAN2 model. This provides a robust "prior" for facial structures, ensuring that the model maintains high structural integrity even under heavy stylization.
  2. Hyper-networks for Weight Deltas: The core innovation is the use of a hyper-network—a secondary model that takes a content image and a style code as input. Instead of generating pixels, it predicts "weight deltas" (small updates) for the StyleGAN2 generator. This allows the system to specialize the generator for a specific style in a single forward pass.
  3. ALADIN Metric Space: To represent style, the model employs ALADIN (All Layer AdaIN), a metric embedding space specifically optimized for artistic style. This allows for smooth interpolation between different styles and enables style-based visual search.
  4. Semantic Conditioning: The model incorporates semantic maps generated by the FaRL (Facial Representation Learning) algorithm. By conditioning the hyper-network on these maps, the system can apply style parameters on a per-region basis, ensuring that textures are applied appropriately to specific anatomical features like hair, skin, or eyes.

Design Insights and Training

Through the development of HyperNST, several key insights were identified regarding the behavior of generative priors in stylization:

  • The "Sweet Spot" for Stylization: The authors found that fine-tuning only the later layers of StyleGAN2 (specifically from layer 13 onwards) provides the optimal balance. Updating earlier layers tends to destroy the underlying facial structure, while updating only the final layers results in superficial color changes without meaningful texture transfer.
  • Unifying Search and Synthesis: The use of ALADIN embeddings suggests a workflow where users can search a database for a specific style and immediately apply or interpolate that style onto a content image using the same latent representation.
  • Semantic Patch Discriminator: To ensure stylistic accuracy, the training process utilizes a discriminator that evaluates specific semantic patches (e.g., comparing hair patches in the output to hair patches in the style reference). This ensures that the "texture" of the style is localized correctly.

Performance and Results

HyperNST demonstrates significant improvements over existing state-of-the-art (SOTA) methods in both fidelity and efficiency:

  • Content Preservation: In comparisons with Swapping Autoencoders (SAE), HyperNST showed vastly superior structural fidelity. It achieved an LPIPS (Alexnet) score of 0.000042, compared to SAE's 0.3345, indicating that the original content's identity and structure are much better preserved.
  • Inference Speed: The model completes a forward pass in approximately 0.35 seconds on an NVIDIA RTX 3090. While slightly slower than the simplest feed-forward models, it is orders of magnitude faster than optimization-based approaches.
  • Controllability: Because HyperNST operates within the StyleGAN latent space, users can perform standard GAN editing—such as adjusting age, expression, or pose—simultaneously with artistic stylization.

Limitations and Future Directions

Despite its performance, HyperNST has specific hardware and domain constraints. Training the hyper-network is memory-intensive, requiring approximately 22GB of VRAM for a batch size of one. This currently limits the model to a resolution of 256x256; scaling to 1024x1024 would cause a significant explosion in the hyper-network's parameter count.

Additionally, the current implementation is domain-specific, focusing exclusively on human portraits. Future research will explore generalizing this hyper-network approach to broader categories, such as landscapes and architectural photography, and optimizing the architecture to reduce VRAM requirements for higher-resolution outputs.

Summary updated

BibTeX
@inproceedings{ruta2022hypernst,
  author = {Dan Ruta and Andrew Gilbert and Saeid Motiian and Baldo Faieta and Zhe Lin and John P. Collomosse},
  title = {{HyperNST: Hyper-Networks for Neural Style Transfer}},
  booktitle = {Workshops @ ECCV},
  year = {2022},
  doi = {10.1007/978-3-031-25056-9\_14},
}
Figure