Deep Translation Prior: Test-time Training for Photorealistic Style Transfer

Sunwoo Kim, Soohyun Kim, Seungryong Kim

Abstract: Recent techniques to solve photorealistic style transfer within deep convolutional neural networks (CNNs) generally require intensive training from large-scale datasets, thus having limited applicability and poor generalization ability to unseen images or styles. To overcome this, we propose a novel framework, dubbed Deep Translation Prior (DTP), to accomplish photorealistic style transfer through test-time training on given input image pair with untrained networks, which learns an image pair-specific translation prior and thus yields better performance and generalization. Tailored for such test-time training for style transfer, we present novel network architectures, with two sub-modules of correspondence and generation modules, and loss functions consisting of contrastive content, style, and cycle consistency losses. Our framework does not require offline training phase for style transfer, which has been one of the main challenges in existing methods, but the networks are to be solely learned during test-time. Experimental results prove that our framework has a better generalization ability to unseen image pairs and even outperforms the state-of-the-art methods.

Introduction

Photorealistic style transfer aims to apply the artistic "feel" of a style image to a content image while maintaining the structural integrity and realism of the original. For instance, a successful transfer might change a daytime city scene to look like a nighttime photo without warping the geometry of the buildings.

Existing methods generally fall into two paradigms:

  1. Optimization-based: These optimize the pixels of an image directly. While flexible, they lack a "prior" (a sense of what a real image should look like), often leading to messy artifacts and a lack of photorealism.
  2. Learning-based: These train complex decoders on massive datasets (like ImageNet). While they produce cleaner results, they often fail to generalize to images or styles not seen during training and cannot adapt to the unique relationship between a specific pair of content and style images.
Comparison of style transfer paradigms: (a) Optimization-based, (b) Learning-based, and (c) the proposed Deep Translation Prior (DTP).

The Deep Translation Prior (DTP) Framework

The core innovation of DTP is the use of an untrained neural network as a regularizer. Inspired by "Deep Image Prior," the authors argue that the architecture of a network itself can act as a prior. Instead of using a fixed, pre-trained network, DTP initializes an untrained network and optimizes its weights specifically for the input image pair at test-time.

The architecture consists of two main sub-modules:

  • Correspondence Module: This module uses a pre-trained (but fine-tuned during the process) VGG-19 backbone to find semantically similar points between the content and style images. It creates a "warped" style feature and a "warped" style image that act as a rough draft for the stylization.
  • Generation Module: An untrained decoder takes these warped features and learns to refine them. It predicts a "residual" (the difference) to produce the final stylized image, which helps the model converge faster and maintain high-frequency details.
Detailed architecture of the DTP framework, highlighting the Correspondence and Generation modules.

To guide this test-time learning, the framework employs a sophisticated loss function including Contrastive Content Loss (InfoNCE) for structural preservation, Multi-scale Style Loss for capturing style at different levels of detail, and Cycle Consistency Loss to ensure the stylized features can be mapped back to the original, improving stability.

Key Insights

  • The Network is the Prior: The internal structure of a convolutional neural network is naturally biased toward natural image statistics. By optimizing the weights rather than the pixels, the network acts as a filter that prevents the noise and artifacts common in traditional optimization methods.
  • Image-Pair Specificity: Every pair of images has a unique geometric and semantic relationship. DTP's test-time training allows the model to adapt specifically to the nuances of the translation task at hand.
  • Residual Learning for Stability: By having the network learn the difference between a warped style image and the final result, the authors significantly improved the stability and convergence of the test-time optimization.

Results and Evaluation

The researchers evaluated DTP on standard photorealistic benchmarks and high-quality face datasets like CelebA-HQ and FFHQ.

  • Quantitative Superiority: DTP achieved the best (lowest) Pieapp (PE) scores—a metric for semantic consistency—and high SSIM scores, indicating it preserves structure better than competitors like WCT2 or STROTSS.
  • User Preference: In a study of 80 participants, DTP was ranked as the "most preferred" method nearly 90% of the time for its balance of style relevance and image quality.
  • No Masks Required: Unlike many previous photorealistic methods that require manual segmentation masks to prevent color bleeding (e.g., keeping the sky from bleeding into the grass), DTP achieves clean boundaries automatically through its correspondence module.

Limitations and Future Work

Because the model must be "trained" for every new image pair, it is significantly slower than feed-forward learning-based methods, taking approximately 150 seconds per image pair on an RTX 3090. Additionally, the non-convex nature of the loss function means the model can occasionally get stuck in local minima if the initial correspondence is poor. Future directions include exploring ways to speed up the optimization process or applying the DTP concept to video stylization.

Summary updated

Abstract

Recent techniques to solve photorealistic style transfer within deep convolutional neural networks (CNNs) generally require intensive training from large-scale datasets, thus having limited applicability and poor generalization ability to unseen images or styles. To overcome this, we propose a novel framework, dubbed Deep Translation Prior (DTP), to accomplish photorealistic style transfer through test-time training on given input image pair with untrained networks, which learns an image pair-specific translation prior and thus yields better performance and generalization. Tailored for such test-time training for style transfer, we present novel network architectures, with two sub-modules of correspondence and generation modules, and loss functions consisting of contrastive content, style, and cycle consistency losses. Our framework does not require offline training phase for style transfer, which has been one of the main challenges in existing methods, but the networks are to be solely learned during test-time. Experimental results prove that our framework has a better generalization ability to unseen image pairs and even outperforms the state-of-the-art methods.
BibTeX
@inproceedings{kim2022deep,
  author = {Sunwoo Kim and Soohyun Kim and Seungryong Kim},
  title = {{Deep Translation Prior: Test-time Training for Photorealistic Style Transfer}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2022},
  url = {https://openreview.net/forum?id=AzCRWGU7TyL},
}
Figure