Color Transfer with Modulated Flows

Maria A. Larchenko, Alexander Lobashev, Dmitry Guskov, Vladimir Vladimirovich Palyulin

Introduction

Color transfer—the task of adjusting the palette of a "content" image to match a "style" reference—is a fundamental challenge in image processing. Existing approaches often struggle with a trade-off between speed and quality. Classical methods like histogram matching are efficient but prone to grainy artifacts. Conversely, neural methods can capture complex styles but often suffer from texture leakage or memory constraints at high resolutions like 4K.

The "gold standard" for this task is Optimal Transport (OT), which defines the most efficient morphing between color distributions. However, solving OT per image pair is computationally expensive. Modulated Flows (ModFlows) addresses this by combining the mathematical rigor of rectified flows with the efficiency of a modulated encoder architecture.

Methodology

The ModFlows framework introduces a shared latent bridge to simplify the color mapping process. Rather than mapping content directly to style, every image is mapped to a neutral 3D RGB cube where colors are uniformly distributed.

Mapping images to a shared uniform latent space (3D RGB cube).

Rectified Flows and Modulation

ModFlows utilizes Rectified Flows, a generative modeling technique that learns a velocity field to move points between distributions along straight paths. Because these flows are bijective (invertible), the latent space acts as a universal intermediary.

To enable real-time inference, the authors trained an EfficientNet B6 encoder to predict the parameters ($e$) of the flow mapping for any given image. This "modulation" allows the system to generalize across a wide variety of styles without requiring per-image optimization. During inference, the encoder predicts weights for both content and style images, and a simple Ordinary Differential Equation (ODE) solver performs the transfer in just 8 steps.

The Modulated Encoder predicts flow parameters $e$ to minimize the difference between predicted and dataset-derived velocities.

Key Results and Insights

ModFlows demonstrates state-of-the-art performance in balancing style similarity with content preservation, outperforming methods like PhotoWCT2 and MKL.

A significant finding is the implicit regularization provided by the encoder. The predicted flows exhibit a lower average Lipschitz constant (37.26) compared to raw Rectified Flows (91.34). This "smoother" mapping naturally prevents visual artifacts and "broken" pixels, leading to higher visual fidelity. Furthermore, the predicted weights ($e$) serve as effective style embeddings, enabling efficient style-based image retrieval.

Discussion and Limitations

While ModFlows excels at global color distribution matching, it currently lacks semantic awareness. Because it operates purely on 3D RGB distributions, it may perform unintended color swaps—for example, turning a yellow shirt red if the style image is predominantly red—without regard for object identity. Future work aims to incorporate semantic information, such as object segmentation, to refine local color assignments and prevent such semantic inconsistencies.

Summary updated

BibTeX
@inproceedings{larchenko2025color,
  author = {Maria A. Larchenko and Alexander Lobashev and Dmitry Guskov and Vladimir Vladimirovich Palyulin},
  title = {{Color Transfer with Modulated Flows}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i4.32470},
}
Figure