Abstract
Normalizing Flows (NFs) are able to model complicated distributions $p(y)$ with strong inter-dimensional correlations and high multimodality by transforming a simple base density $p(z)$ through an invertible neural network under the change of variables formula. Such behavior is desirable in multivariate structured prediction tasks, where handcrafted per-pixel loss-based methods inadequately capture strong correlations between output dimensions. We present a study of conditional normalizing flows (CNFs), a class of NFs where the base density to output space mapping is conditioned on an input $x$, to model conditional densities $p(y|x)$. CNFs are efficient in sampling and inference, they can be trained with a likelihood-based objective, and CNFs, being generative flows, do not suffer from mode collapse or training instabilities. We provide an effective method to train continuous CNFs for binary problems and in particular, we apply these CNFs to super-resolution and vessel segmentation tasks demonstrating competitive performance on standard benchmark datasets in terms of likelihood and conventional metrics.
Introduction
In structured prediction tasks, the goal is to map an input $x$ to a high-dimensional output $y$, such as a high-resolution image or a segmentation mask. Traditional deep learning approaches often utilize "factored" models, which assume conditional independence between output pixels given the input. This assumption frequently leads to two significant drawbacks: the "blurry mean" effect, where models trained with Mean Squared Error (MSE) produce averaged, non-crisp outputs, and poor calibration, where models over-estimate structures to minimize loss.
Conditional Normalizing Flows (CNFs) address these issues by learning the full conditional distribution $p(y|x)$. Unlike Generative Adversarial Networks (GANs), which can produce sharp images but are difficult to train and lack exact likelihood computation, CNFs provide a stable, likelihood-based framework for capturing complex spatial correlations and multimodality.
Methodology
Normalizing Flows use invertible neural networks to transform a simple base distribution (e.g., a Gaussian) into a complex target distribution. In a CNF, both the base distribution $p(z|x)$ and the invertible mapping $f(y, x)$ are conditioned on the input $x$, allowing the model to adapt its learned distribution to each specific input instance.
Handling Discrete Data
A key challenge in applying flows to segmentation is that flows operate in continuous space, while masks are binary. The authors introduce a novel Binary Variational Dequantization method using a softplus transformation. This "half-infinite noise" approach ensures that noise added to positive labels remains positive and noise for negative labels remains negative, facilitating a more effective mapping between discrete labels and the continuous flow space.
Experimental Evaluation
The proposed CNF framework was evaluated on two primary tasks: Single Image Super-Resolution (SISR) and Retinal Vessel Segmentation.
Super-Resolution
Trained on ImageNet32 and ImageNet64, the CNF significantly outperformed factored baselines in negative log-likelihood. Qualitatively, the model successfully generated sharp, high-frequency details—such as individual hairs or grass textures—that are typically lost in MSE-based models. The use of temperature scaling ($ au < 1$) during sampling allowed for a controlled trade-off between output diversity and perceptual quality.
Retinal Vessel Segmentation
Using the DRIVE database, the CNF achieved an F-score of 0.819, competitive with state-of-the-art models like DRIU (0.821). Notably, the CNF achieved these results without the need for ImageNet pre-training.
As shown in the qualitative comparison, the CNF's ability to model inter-pixel correlations prevents the "over-dilation" common in standard CNNs, resulting in masks that better reflect the actual thinness and variety of retinal vessels.
Conclusion
Conditional Normalizing Flows represent a robust alternative to traditional loss-based structured prediction. By learning the underlying data distribution rather than a fixed point estimate, CNFs capture essential spatial structures and provide well-calibrated uncertainty. While computational costs remain a consideration due to the requirements of invertible architectures, the ability to perform exact likelihood inference and generate high-quality samples makes CNFs a promising direction for complex vision tasks.
Summary updated