Diff-2-in-1: Bridging Generation and Dense Perception with Diffusion Models

## Abstract

Abstract Beyond high-fidelity image synthesis, diffusion models have recently exhibited promising results in dense visual perception tasks. However, most existing work treats diffusion models as a
standalone component for perception tasks, employing them either solely for off-the-shelf data augmentation or as mere feature extractors. In contrast to these isolated and thus sub-optimal efforts, we introduce a unified, versatile, diffusion-based framework, Diff-2-in-1, that can simultaneously handle both multi-modal data generation and dense visual perception, through a unique exploitation of the diffusion-denoising process .
Within this framework, we further enhance discriminative visual perception via multi-modal generation, by utilizing the denoising network to create multi-modal data that mirror the distribution of the original training set.
Importantly, Diff-2-in-1 optimizes the utilization of the created diverse and faithful data by leveraging a novel self-improving learning mechanism. Comprehensive experimental evaluations validate the effectiveness of our framework, showcasing consistent performance improvements across various discriminative backbones and high-quality multi-modal data generation characterized by both realism and usefulness.

## 1 Introduction

Diffusion models have emerged as powerful generative modeling tools for various high-fidelity image synthesis tasks (Song et al., ; Ho et al., ; Rombach et al., ; Zhang et al., ). Beyond their primary synthesis capabilities, diffusion models are increasingly recognized for their expressive representation abilities. This has spurred interest in leveraging them for dense pixel-level visual perception tasks, such as semantic segmentation (Baranchuk et al., ; Wu et al., ; Xu et al., ) and depth estimation (Saxena et al., ; Zhao et al., ). Nonetheless, most existing approaches treat diffusion models as a *standalone* component for perception tasks, either employing them for off-the-shelf data augmentation (Burg et al., ), or utilizing the diffusion network as feature extraction backbone (Xu et al., ; Zhao et al., ; Ji et al., ; Saxena et al., ). These efforts overlook the *unique* diffusion-denoising process inherent in diffusion models, thus limiting their potential for discriminative dense visual perception tasks.

Inspired by foundational studies that explore the interplay between generative and discriminative learning (Rubinstein & Hastie, ; Ng & Jordan, ; Raina et al., ; Ulusoy & Bishop, ), we argue that the diffusion-denoising process plays a critical role in unleashing the capability of diffusion models for the discriminative visual perception tasks. The diffusion process corrupts the visual input with noise, enabling the *generation* of abundant new data with diversity. Subsequently, the denoising process removes the noise from noisy images to create high-fidelity data, thus obtaining informative features for *discriminative* tasks at the same time. As a result, the diffusion-denoising process naturally connects the generative process with discriminative learning.

Interestingly, this synergy further motivates us to propose a novel unified diffusion modeling framework that integrates both discriminative and generative learning within a single, coherent paradigm. From the generative perspective, we focus on synthesizing photo-realistic *multi-modal* paired data (*i.e*., RGB images and their associated pixel-level visual attributes) that accurately capture various types of visual information. Simultaneously, the unified diffusion model can achieve promising results in different visual prediction tasks from the discriminative standpoint. As an example illustrated in Figure 1, when considering RGB and depth interactions, if the model receives an RGB image as input, its function is to predict an accurate depth map. Meanwhile, the model is equipped to produce photo-realistic and coherent RGB-depth pairs sampled from noise.
Despite its conceptual simplicity, fully operationalizing the unified framework – acquiring enhanced performance for both multi-modal generation and dense perception such as by effectively leveraging generated samples for discriminative tasks – presents non-trivial challenges.
In particular, the generation process inevitably produces data of relatively inferior quality compared to real data. Additionally, generated samples may exhibit considerable data distribution gaps from the target domain.

Figure: Figure 1: A single, unified diffusion-based model for both generative and discriminative learning. If the model receives an RGB image as input, its function is to predict an accurate visual attribute map. Simultaneously, the model is equipped to produce photo-realistic and coherent multi-modal data sampled from Gaussian noise. We use depth as an example here for illustration, and the framework is also applicable to other visual attributes such as segmentation, surface normal, *etc*.
Refer to caption: x1.png

To address these challenges, we introduce Diff-2-in-1, a diffusion framework bridging multi-modal generation and discriminative dense visual perception within one unified diffusion model.
The core design within our Diff-2-in-1 is a self-improving learning mechanism, featuring two sets of parameters for our unified diffusion model during the training process. Specifically, the creation parameters are tailored to generate additional multi-modal data for discriminative learning, while the exploitation parameters are employed for utilizing both the original and synthetic data to learn the discriminative dense visual perception task. Meanwhile, the creation parameters continuously undergo self-improvement based on the weights of the exploitation parameters via exponential moving average (EMA). With our novel design of two sets of parameters interplaying with each other, the discriminative learning process can benefit from the synthetic samples generated by the model itself, while the quality of the generated data is iteratively refined at the same time.

We validate the effectiveness of Diff-2-in-1 through extensive and multi-faceted experimental evaluations. We start with the evaluation of the discriminative perspective, demonstrating its superiority over state-of-the-art discriminative baselines across various tasks in both single-task and multi-task settings. We additionally show that Diff-2-in-1 is generally applicable to different backbones and consistently boosts performance. Next, we ablate the experimental settings such as different training data sizes, to gain a comprehensive understanding of our method. Finally, we demonstrate the realism and usefulness of the multi-modal data generated by our Diff-2-in-1.

Our contributions include: (1) We propose Diff-2-in-1, a unified framework that seamlessly integrates multi-modal generation and discriminative dense visual perception based on diffusion models. (2) We introduce a novel self-improving mechanism that progressively enhances multi-modal generation in a self-directed manner, thereby effectively boosting the discriminative visual perception performance via generative learning.
(3) Our method demonstrates consistent performance improvements across various discriminative backbones and high-quality multi-modal data generation under both realism and usefulness.

## 2 Related Work

Pixel-level dense visual perception covers a broad range of discriminative computer vision tasks including depth estimation (Godard et al., ; Eigen et al., ; Guo et al., ; Liu et al., ), segmentation (Long et al., ; Xie et al., ), surface normal prediction (Wang et al., ; Bae et al., ), keypoint detection (Cao et al., ; ; Zhou et al., ; Toshev & Szegedy, ), *etc*. After the
convolutional neural network (CNN) (Krizhevsky et al., ; Simonyan & Zisserman, ; Zeiler & Fergus, ; Szegedy et al., ) shows great success in ImageNet classification (Deng et al., ) even outperforming humans (He et al., ), adopting CNN for dense prediction tasks (Wang et al., ; Eigen & Fergus, ; Eigen et al., ) becomes a prototype for model design. With Vision Transformer (ViT) (Dosovitskiy et al., ) later becoming a revolutionary advance in architecture for vision models, an increasing number of visual perception models (Ranftl et al., ; ; Xie et al., ) start to adopt ViT as their backbones, benefiting from the scalability and global perception capability brought by ViT.

Generative modeling for discriminative tasks. The primary objective of generative models has traditionally been synthesizing photo-realistic images. However, recent advancements have expanded their utility to the generation of “useful” images for downstream visual tasks (Zhan et al., ; Zhu et al., ; Aleotti et al., ; Pilzer et al., ; Zhang et al., ; Zhu et al., ; Zheng et al., ; Bao et al., ). This is typically accomplished by generating images and corresponding annotations off-the-shelf, subsequently using them for data augmentation in specific visual tasks.

Nowadays, with the emergence of powerful diffusion models in high-fidelity synthesis tasks (Song et al., ; Ho et al., ; Rombach et al., ; Zhang et al., ; Wang et al., ; Chen et al., ), there has been a growing interest in applying them to discriminative tasks. Among them, ODISE (Xu et al., ) and VPD (Zhao et al., ) extract features using the stable diffusion model (Rombach et al., ) to perform discriminative tasks such as segmentation and depth estimation. DIFT (Tang et al., ) and its concurrent work (Luo et al., ; Zhang et al., ; Hedlin et al., ) utilize diffusion features for identifying semantic correspondence. DDVM (Saxena et al., ) solves depth and optical flow estimation tasks by denoising from Gaussian noise with RGB images as a condition. Diffusion Classifier (Li et al., ) utilizes diffusion models to enhance the confidence of zero-shot image classification. Other studies (Trabucco et al., ; Feng et al., ; Burg et al., ) have explored using diffusion models to augment training data for image classification. Different from them, we propose a *unified* diffusion-based model that can directly work for discriminative dense visual perception tasks, and simultaneously utilize its generative process to facilitate discriminative learning through the proposed novel self-improving algorithm.

## 3 Unified Diffusion Model: Diff-2-in-1

### 3.1 Preliminary: Latent Diffusion Models

Diffusion models (Ho et al., ) are latent variable models that learn the data distribution with the inverse of a Markov noising process. Instead of leveraging the diffusion models in the RGB color space (Song et al., ; Ho et al., ), we build our method upon the state-of-the-art latent diffusion model (LDM) (Rombach et al., ). First, an encoder $\mathcal{E}$ is trained to map an input image $x\in\mathcal{X}$ into a spatial latent code $z=\mathcal{E}(x)$. A decoder $\mathcal{D}$ is then tasked with reconstructing the input image such that $\mathcal{D}(\mathcal{E}(x))\approx x$.

Considering the clean latent $z_{0}\sim q(z_{0})$, where $q(z_{0})$ is the posterior distribution of $z_{0}$, LDM gradually adds Gaussian noise to $z_{0}$ in the diffusion process:

$$ $q(z_{t}|z_{t-1})=\mathcal{N}(z_{t};\sqrt{1-\beta_{t}}z_{t-1},\beta_{t}\mathbf{ I}),$ (1) $$

where $\beta_{t}$ is a variance schedule that controls the strength of the noise added in each timestep. We can derive a closed-form process from Equation 1 to convert a clean latent $z_{0}$ to a noisy latent $z_{T}$ of arbitrary timestep $T$:

$$ $z_{T}\sim q(z_{T}|z_{0})=\mathcal{N}(z_{T};\sqrt{\bar{\alpha}_{T}}z_{0},(1- \bar{\alpha}_{T})\mathbf{I}),$ (2) $$

where the notation $\alpha_{T}=1-\beta_{T}$ and $\bar{\alpha}_{T}=\prod_{s=1}^{T}\alpha_{s}$ makes the formulation concise. When $T\rightarrow\infty$, $z_{T}$ is nearly equivalent to sampling from an isotropic Gaussian distribution.

The denoising process takes inverse operations from the diffusion process. We estimate the denoised latent at timestep $t-1$ from $t$ by:

$$ $p_{\theta}(z_{t-1}|z_{t})=\mathcal{N}(z_{t-1};\mathbf{\mu}_{\theta}(z_{t},t), \mathbf{\Sigma}_{\theta}(z_{t},t)),$ (3) $$

where the parameters $\mathbf{\mu}_{\theta}(z_{t},t),\mathbf{\Sigma}_{\theta}(z_{t},t)$ of the Gaussian distribution are estimated from the model.

As revealed by Ho et al. (), $\mathbf{\Sigma}_{\theta}(z_{t},t)$ has few effects on the results experimentally, therefore estimating $\mathbf{\mu}_{\theta}(z_{t},t)$ becomes the main objective. A reparameterization is introduced to estimate it:

$$ $\mathbf{\mu}_{\theta}(z_{t},t)=\frac{1}{\sqrt{\alpha_{t}}}\left(z_{t}-\frac{ \beta_{t}}{\sqrt{1-\bar{\alpha}_{t}}}\mathbf{\epsilon}_{\theta}(z_{t},t)\right),$ (4) $$

where $\mathbf{\epsilon}_{\theta}(z_{t},t)$ is a denoising network to predict the additive noise $\epsilon$ for $z_{t}$ at timestep $t$. The final objective is:

$$ $\mathcal{L}_{\textrm{LDM}}:=\mathbb{E}_{\mathcal{E}(x),\epsilon\sim\mathcal{N} (0,1),t}\left[\left\|\epsilon-\epsilon_{\theta}\left(z_{t},t\right)\right\|_{2 }^{2}\right].$ (5) $$

Figure: Figure 2: Our self-improving learning paradigm with two sets of interplayed parameters during training. The data creation parameter $\theta_{\text{C}}$ generates samples serving as additional training data for the data exploitation parameter $\theta_{\text{E}}$, while $\theta_{\text{E}}$ performs discriminative learning and provides guidance to update $\theta_{\text{C}}$ through exponential moving average. Finally, $\theta_{\text{C}}$ performs both discriminative and generative tasks during inference.
Refer to caption: x2.png

### 3.2 A Unified Model Beyond RGB Generation

In this section, we use diffusion-based models for both discriminative and generative tasks to form our Diff-2-in-1 framework. Concretely, for a diffusion-based unified model $\Phi$, we want it to predict task label $\hat{\bm{y}}=\Phi^{\textrm{dis}}(\bm{x})$ given input image $\bm{x}$; meanwhile, after training, it can generate multi-modal paired data from Gaussian: $(\tilde{\bm{x}},\tilde{\bm{y}})=\Phi^{\textrm{gen}}(\epsilon)$. We describe how we achieve this below.

Discriminative perspective. Previous work (Xu et al., ; Zhao et al., ) has demonstrated the possibility of using diffusion models for perceptual tasks. Following VPD (Zhao et al., ), with the latent code ${\bm{z}}=\mathcal{E}({\bm{x}})$ from given image $\bm{x}$, we perform one-step denoising on $\bm{z}$ through the denoising U-Net (Ronneberger et al., ) to produce multi-scale features. Afterward, we rescale and concatenate those features and further pass them to a task head for downstream prediction.

Generative perspective. To generate multi-modal data consisting of paired RGB and visual attributes, we first produce a latent vector $\tilde{z_{0}}$ by denoising from Gaussian with conditional text. Next, we directly generate the color image $\tilde{x}$ by passing it to the LDM decoder; meanwhile, we perform another one-step denoising with $\tilde{z_{0}}$ and send the resulting multi-scale features to the task head to obtain the corresponding label $\tilde{y}$.

The two perspectives reflect different usages of the unified
diffusion model while they are *not* fully separated: performing generation can be treated as a process of denoise-and-predict for a noisy image at timestep $t=T$; while predicting labels can be treated as a process of data generation conditioned on a given latent vector $z_{0}$. This special connection motivates the design of our Diff-2-in-1.

## 4 Learning Mechanism of Diff-2-in-1

To effectively leverage the generated multi-modal data for dense visual perception, we propose a self-improving mechanism for our Diff-2-in-1 framework to make the discriminative and generative processes interact with each other, as shown in Figure 2. The details are described as below.

### 4.1 Warm-up Stage

Since pretrained diffusion models are only designed for RGB generation, we need a warm-up stage to activate the task head in Figure 2 for additional tasks. To achieve this, we train our unified diffusion model using its discriminative learning pipeline with all the original training data with loss

$$ $\mathcal{L}=\sum_{i=1}^{N}\mathcal{L}_{\textrm{sup}}(f_{\theta_{\text{W}}}(\bm {x}_{i}),\bm{y}_{i}),$ (6) $$

where $\mathcal{L}_{\textrm{sup}}$ is the supervised loss for our chosen discriminative task on the original paired training data $D_{\textrm{train}}=\{\bm{x}_{i},\bm{y}_{i}\}_{i=1}^{N}$. We obtain a set of parameter weights $\theta_{\text{W}}$ after this warm-up stage.

### 4.2 Data Generation

Table: Figure 3: Real data samples from NYUv2 and synthesized samples generated from Gaussian noise. The distribution of the generated data varies from the real data distribution.

Many approaches (Feng et al., ; Burg et al., ) that use diffusion models for data augmentation generate data from Gaussian noise as discussed in Section 3.2. However, as shown in Figure 3, the synthetic samples generated from Gaussian noise have a non-negligible distribution shift from the original training data, posing huge obstacles to utilizing the generated data for boosting the discriminative task performance. To narrow down the domain gap between the generated data and original data, inspired by SDEdit (Meng et al., ) and DA-Fusion (Trabucco et al., ), we use the inherent diffusion-denoising mechanism to control the data generation process.

Concretely, we add noise to the latent $z_{i}$ of an image $\bm{x}_{i}$ from the training set using Equation 2 at a timestep $T$ satisfying $0<T<T_{\textrm{max}}$, where $T_{\textrm{max}}$ is the maximum timestep in the training process of diffusion models ($T_{\textrm{max}}=1000$ for all our experiments). This process partially corrupts the image with noise, yet maintains a degree of the original content, as depicted in the first row of Figure 4.
After denoising the noisy image with Equation 3 and decoding with the variational autoencoder, we obtain the synthetic image $\tilde{\bm{x}}_{i}$ with different content but a relatively small domain gap, as shown in the second row of Figure 4. At the same time, we can obtain the prediction $\tilde{\bm{y}}_{i}$ which is decoded from the task head of the unified diffusion model. As shown in the third row of Figure 4, the generated annotations (surface normal as an example) well match the generated RGB images. The timestep $T$, representing the noise level, acts as a modulator, balancing the diversity of the generated samples and the fidelity to the in-distribution data: higher noise levels lead to greater diversity, whereas lower levels enhance the resemblance to the original distribution.

**Table 1: Surface normal evaluation on NYUv2 (Silberman et al., ; Ladicky et al., ). When applying our Diff-2-in-1 on top of state-of-the-art baselines, we achieve consistently and significantly better performance with notably fewer training data, demonstrating the advantages of data efficiency from our unified diffusion model. Additionally, Diff-2-in-1 outperforms augmentation methods GNA and DA-Fusion, proving the usefulness of the multi-modal data generated by our pipeline, and the effectiveness of our self-improving mechanism in utilizing synthetic data.**
| Model | Training Samples | $11.25^{\circ}$ ($\uparrow$) | $22.5^{\circ}$ ($\uparrow$) | $30^{\circ}$ ($\uparrow$) | Mean ($\downarrow$) | Median ($\downarrow$) | RMSE ($\downarrow$) |
| --- | --- | --- | --- | --- | --- | --- | --- |
| SkipNet (Bansal et al., ) | 795 | 47.9 | 70.0 | 77.8 | 19.8 | 12.0 | 28.2 |
| GeoNet (Qi et al., ) | 30,816 | 48.4 | 71.5 | 79.5 | 19.0 | 11.8 | 26.9 |
| PAP (Zhang et al., ) | 12,795 | 48.8 | 72.2 | 79.8 | 18.6 | 11.7 | 25.5 |
| GeoNet++ (Qi et al., ) | 30,816 | 50.2 | 73.2 | 80.7 | 18.5 | 11.2 | 26.7 |
| Bae et al. () | 30,816 | 62.2 | 79.3 | 85.2 | 14.9 | 7.5 | 23.5 |
| Bae et al. () | 795 | 56.6 | 76.8 | 83.0 | 17.2 | 9.3 | 26.6 |
| GNA on Bae *et al*. | 795 | 56.4 | 76.7 | 83.0 | 17.3 | 9.3 | 26.7 |
| DA-Fusion (Trabucco et al., ) on Bae *et al*. | 795 | 58.1 | 77.5 | 83.6 | 16.8 | 8.9 | 26.1 |
| Diff-2-in-1 on Bae *et al*. (Ours) | 795 | 67.4 | 83.4 | 88.2 | 13.2 | 6.5 | 22.0 |
| iDisc (Piccinelli et al., ) | 30,816 | 63.8 | 79.8 | 85.6 | 14.6 | 7.3 | 22.8 |
| iDisc (Piccinelli et al., ) | 795 | 57.3 | 76.4 | 82.9 | 17.8 | 8.8 | 26.4 |
| GNA on iDisc | 795 | 56.9 | 76.2 | 82.4 | 18.1 | 8.9 | 26.7 |
| DA-Fusion (Trabucco et al., ) on iDisc | 795 | 58.7 | 78.3 | 83.4 | 17.3 | 8.6 | 26.2 |
| Diff-2-in-1 on iDisc<br>(Ours) | 795 | 68.7 | 83.7 | 88.4 | 12.7 | 6.0 | 21.6 |

**Table 2: Comparison with diffusion-based segmentation method VPD (Zhao et al., ). The other baselines follow the setting of VPD, which utilize features from supervised pretraining (Liu et al., ; ), self-supervised pretraining (He et al., ), and visual-language pretraining (Rao et al., ) combined with a learnable segmentation head (Xiao et al., ). Our proposed Diff-2-in-1 further improves the performance of the diffusion-based VPD model.**
| Model | mIoU ($\uparrow$) |
| --- | --- |
| Swin-L (Liu et al., ) | 52.1 |
| ConvNeXt-L (Liu et al., ) | 53.2 |
| ConvNeXt-XL (Liu et al., ) | 53.6 |
| MAE-ViT-L/16 (He et al., ) | 53.6 |
| CLIP-ViT-B (Rao et al., ) | 50.6 |
| VPD (Zhao et al., ) | 53.7 |
| DA-Fusion (Trabucco et al., ) on VPD | 54.0 |
| Diff-2-in-1 on VPD<br>(Ours) | 54.5 |

### 4.3 Self-improving Stage

To more effectively utilize the generated multi-modal data, we propose a self-improving mechanism inspired by the mean teacher learning system (Tarvainen & Valpola, ).
As shown in Figure 2, our self-improving mechanism introduces the following two sets of parameters, both are initialized with $\theta_{\text{W}}$, to iteratively perform the self-improvement for both generative and discriminative learning.

Data creation network ($\theta_{\text{C}}$) is used to create samples through the generative process within our unified diffusion model. During every iteration, for a batch of $m$ real paired data $\{(\bm{x}_{i},\bm{y}_{i})\}_{i=1}^{m}$, we additionally generate $n$ paired samples $\{(\tilde{\bm{x}}_{i},\tilde{\bm{y}}_{i})\}_{i=1}^{n}$ with $\theta_{\text{C}}$ following the data creation scheme described in Section 4.2. Both real and synthetic data are used for data exploitation.

Data exploitation network ($\theta_{\text{E}}$) is used for exploring the parameter space by exploiting both the original and the synthetic data samples to learn the discriminative task. With those $m+n$ samples, $\theta_{\text{E}}$ is updated via the discriminative loss:

$$ $\mathcal{L}=\sum_{i=1}^{m}\mathcal{L}_{\textrm{sup}}(f_{\theta_{\text{E}}}(\bm {x}_{i}),\bm{y}_{i})+\sum_{i=1}^{n}\mathcal{L}_{\textrm{syn}}(f_{\theta_{\text {E}}}(\tilde{\bm{x}}_{i}),\tilde{\bm{y}}_{i}),$ (7) $$

where $\mathcal{L}_{\textrm{syn}}$ is the loss term for synthetic data for which we regard the generated annotation $\tilde{\bm{y}}_{i}$ as the ground truth. It has the same format as the supervised loss $\mathcal{L}_{\textrm{sup}}$.

Feedback from data exploitation: EMA optimization. The additional generated data from $\theta_{\text{C}}$ naturally facilitate the training of $\theta_{\text{E}}$. In response, we apply a feedback from $\theta_{\text{E}}$ to $\theta_{\text{C}}$ to update its weights every few iterations via the exponential moving average (EMA) strategy:

$$ $\theta_{\text{C}}\leftarrow\alpha\theta_{\text{C}}+(1-\alpha)\theta_{\text{E}},$ (8) $$

where $\alpha\in[0,1)$ is a momentum hyperparameter that is usually set to close to 1. As discussed in Section 3.2, the data generation process essentially follows a denoise-and-predict manner, so Equation 8 ensures $\theta_{\text{C}}$ to have a better task prediction head thereby producing higher-quality multi-modal data. A large $\alpha$ maintains the overall quality of the generated data, preventing $\theta_{\text{C}}$ from getting distracted by the inevitable inferior data.

After the self-improvement, only one set of parameter, $\theta_{\text{C}}$, is used to perform both generative and discriminative tasks during inference. The capability of this final model, regarding both discriminative learning and multi-modal data generation, gets promoted simultaneously.

## 5 Experimental Evaluation

**Table 3: Comparison with state-of-the-art methods on the multi-task NYUD-MT (Silberman et al., ) benchmark. Our Diff-2-in-1 brings additional performance gain to the state-of-the-arts.**
| Model | Semseg | Depth | Normal |
| --- | --- | --- | --- |
| mIoU ($\uparrow$) | RMSE ($\downarrow$) | mErr ($\downarrow$) |  |
| Cross-stitch (Misra et al., ) | 36.34 | 0.6290 | 20.88 |
| PAP (Zhang et al., ) | 36.72 | 0.6178 | 20.82 |
| PSD (Zhou et al., ) | 36.69 | 0.6246 | 20.87 |
| PAD-Net (Xu et al., ) | 36.61 | 0.6270 | 20.85 |
| NDDR-CNN (Gao et al., ) | 36.72 | 0.6288 | 20.89 |
| MTI-Net (Vandenhende et al., ) | 45.97 | 0.5365 | 20.27 |
| ATRC (Bruggemann et al., ) | 46.33 | 0.5363 | 20.18 |
| DeMT (Xu et al., ) | 51.50 | 0.5474 | 20.02 |
| MQTransformer (Xu et al., ) | 49.18 | 0.5785 | 20.81 |
| DeMT (Xu et al., ) | 51.50 | 0.5474 | 20.02 |
| InvPT (Ye & Xu, ) | 53.56 | 0.5183 | 19.04 |
| DA-Fusion (Trabucco et al., ) on InvPT | 53.70 | 0.5167 | 18.81 |
| Diff-2-in-1 on InvPT<br>(Ours) | 54.71 | 0.5015 | 18.60 |
| TaskPrompter (Ye & Xu, ) | 55.30 | 0.5152 | 18.47 |
| DA-Fusion (Trabucco et al., ) on TaskPrompter | 55.13 | 0.5065 | 18.15 |
| Diff-2-in-1 on TaskPrompter<br>(Ours) | 55.73 | 0.5041 | 17.91 |

**Table 4: Comparison on the multi-task PASCAL-Context (Mottaghi et al., ) benchmark. Equipped with our Diff-2-in-1, the state-of-the-art methods reach an overall better performance.**
| Model | Semseg | Parsing | Saliency | Normal |
| --- | --- | --- | --- | --- |
| mIoU ($\uparrow$) | mIoU ($\uparrow$) | maxF ($\uparrow$) | mErr ($\downarrow$) |  |
| ASTMT (Maninis et al., ) | 68.00 | 61.10 | 65.70 | 14.70 |
| PAD-Net (Xu et al., ) | 53.60 | 59.60 | 65.80 | 15.30 |
| MTI-Net (Vandenhende et al., ) | 61.70 | 60.18 | 84.78 | 14.73 |
| ATRC-ASPP (Bruggemann et al., ) | 63.60 | 60.23 | 83.91 | 14.30 |
| ATRC-BMTAS (Bruggemann et al., ) | 67.67 | 62.93 | 82.29 | 14.24 |
| MQTransformer (Xu et al., ) | 71.25 | 60.11 | 84.05 | 14.74 |
| DeMT (Xu et al., ) | 75.33 | 63.11 | 83.42 | 14.54 |
| InvPT (Ye & Xu, ) | 79.03 | 67.61 | 84.81 | 14.15 |
| DA-Fusion (Trabucco et al., ) on InvPT | 79.33 | 68.45 | 84.45 | 14.04 |
| Diff-2-in-1 on InvPT<br>(Ours) | 80.36 | 69.55 | 84.64 | 13.89 |
| TaskPrompter (Ye & Xu, ) | 80.89 | 68.89 | 84.83 | 13.72 |
| DA-Fusion (Trabucco et al., ) on TaskPrompter | 80.81 | 69.23 | 84.47 | 13.70 |
| Diff-2-in-1 on TaskPrompter<br>(Ours) | 80.93 | 69.73 | 84.35 | 13.64 |

**Table 5: Ablation study on different timesteps $T$ during the data generation process within Diff-2-in-1. A medium timestep $T=600$ achieves the best performance, but overall Diff-2-in-1 is robust to different choices of $T$.**
| Model | $T$ | $11.25^{\circ}$ ($\uparrow$) | $22.5^{\circ}$ ($\uparrow$) | $30^{\circ}$ ($\uparrow$) | Mean ($\downarrow$) | Median ($\downarrow$) | RMSE ($\downarrow$) |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Diff-2-in-1 on Bae et al. () | 300 | 67.2 | 83.3 | 88.1 | 13.3 | 6.6 | 22.1 |
| 600 | 67.4 | 83.4 | 88.2 | 13.2 | 6.5 | 22.0 |  |
| 800 | 67.3 | 83.3 | 88.1 | 13.3 | 6.6 | 22.1 |  |
| Diff-2-in-1 on iDisc (Piccinelli et al., ) | 300 | 68.6 | 83.6 | 88.4 | 12.8 | 6.0 | 21.6 |
| 600 | 68.7 | 83.7 | 88.4 | 12.7 | 6.0 | 21.6 |  |
| 800 | 68.5 | 83.6 | 88.3 | 12.8 | 6.0 | 21.6 |  |

**Table 6: Cross-domain evaluation on the surface normal estimation task of NYUv2 (Silberman et al., ; Ladicky et al., ). The performance of our method trained on ScanNet even outperforms the baseline Bae *et al*. trained on NYUv2, suggesting our generalizability to unseen datasets.**
| Model | Source $\rightarrow$ Target | $11.25^{\circ}$ ($\uparrow$) | $22.5^{\circ}$ ($\uparrow$) | $30^{\circ}$ ($\uparrow$) | Mean ($\downarrow$) | Median ($\downarrow$) | RMSE ($\downarrow$) |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Bae et al. () | ScanNet $\rightarrow$ NYUv2 | 59.0 | 77.5 | 83.7 | 16.0 | 8.4 | 24.7 |
| NYUv2 $\rightarrow$ NYUv2 | 62.2 | 79.3 | 85.2 | 14.9 | 7.5 | 23.5 |  |
| Diff-2-in-1 on Bae et al. ()(Ours) | ScanNet $\rightarrow$ NYUv2 | 63.0 | 80.4 | 86.0 | 14.6 | 7.3 | 23.3 |

### 5.1 Evaluation Setup

We first evaluate our proposed Diff-2-in-1 in the single-task settings with surface normal estimation and semantic segmentation as targets. Next, we apply Diff-2-in-1 in multi-task settings of NYUD-MT (Silberman et al., ) and PASCAL-Context (Mottaghi et al., ) to show that it can provide universal benefit for more tasks simultaneously.

Datasets and metrics. We evaluate surface normal estimation on the NYUv2 (Silberman et al., ; Ladicky et al., ) dataset. Different from previous methods that leverage additional raw data for training, we only use the 795 training samples. We include the number of training samples for each method in Table 1 for reference. Following Bae et al. () and iDisc (Piccinelli et al., ), we adopt $11.25^{\circ},22.5^{\circ},30^{\circ}$ to measure the percentage of pixels with lower angle error than the corresponding thresholds. We also report the mean/median angle error and the root mean square error (RMSE) of all pixels. We evaluate semantic segmentation on the ADE20K (Zhou et al., ) dataset and use mean Intersection-over-Union (mIoU) as the metric. For multi-task evaluations, NYUD-MT spans across three tasks including semantic segmentation, monocular depth estimation, and surface normal estimation; PASCAL-Context takes semantic segmentation, human parsing, saliency detection, and surface normal estimation for evaluation. We adopt mIoU for semantic segmentation and human parsing, RMSE for monocular depth estimation, maximal F-measure (maxF) for saliency detection, and mean error (mErr) for surface normal estimation, following the same standard evaluation schemes (Misra et al., ; Zhang et al., ; Zhou et al., ; Xu et al., ; Gao et al., ; Vandenhende et al., ; Bruggemann et al., ; Xu et al., ; Maninis et al., ; Xu et al., ; Ye & Xu, ; ).

Key implementation details. To speed up training, instead of creating the paired data on the fly which takes significantly longer time due to denoising, we pre-synthesize a certain number of RGB images and later use $\theta_{C}$ to produce corresponding labels during the self-improving stage. More details about datasets, baselines, and implementations are included in Section A in the appendix.

### 5.2 Downstream Task Evaluation

Surface normal estimation. We build our Diff-2-in-1 on two state-of-the-art surface normal prediction frameworks: Bae et al. () and iDisc (Piccinelli et al., ). Our Diff-2-in-1 creates 500 synthetic pairs with timestep $T=600$ (refer to Section 4.2). Besides conventional methods, we include two additional baselines with diffusion-based data augmentation. DA-Fusion (Trabucco et al., ) generates in-distribution RGB images with labels sharing a similar spirit as us, but only focuses on improving image classification task. To adapt it for dense pixel prediction, we adopt an off-the-shelf captioning strategy (Li et al., ) to replace its textual inversion and apply the pretrained instantiated model to get the pixelwise annotations for the generated images. Afterward, the generated RGB-annotation pairs are utilized in the same way as DA-Fusion originally uses RGB-class pairs to boost the performance. Gaussian Noise Augmentation (GNA) is a self-constructed baseline that generates additional data by denoising from Gaussian noise, then applies the self-improving strategy to utilize the generated data.

With the results shown in Table 1, we observe: (1) When applying our Diff-2-in-1 on top of the state-of-the-art baselines, we achieve significantly better performance with notably fewer training data, demonstrating the great advantages of data efficiency from a unified diffusion model. (2) Our Diff-2-in-1 has better performance than other augmentation methods like GNA and DA-Fusion, showcasing the usefulness of the multi-modal data generated by our pipeline, and the effectiveness of synthetic data utilization with our self-improving mechanism. (3) Our Diff-2-in-1 is a general design that can universally bring benefits to different discriminative backbones.

Semantic segmentation. We instantiate our Diff-2-in-1 on VPD (Zhao et al., ), a diffusion-based segmentation model.
For self-improving, we synthesize one sample for each image in the training set. With the results shown in Table 2, we observe that the diffusion-based VPD can benefit from our paradigm by effectively performing self-improvement to leverage the generated samples.

Multi-task evaluations. We apply our Diff-2-in-1 on two state-of-the-art multi-task methods, InvPT (Ye & Xu, ) and TaskPrompter (Ye & Xu, ). A total of 500 synthetic samples are generated for NYUD-MT following the surface normal evaluation. For PASCAL-Context, one sample is synthesized for each image in the training set with our Diff-2-in-1. The comparisons on NYUD-MT and PASCAL-Context are shown in Table 3 and Table 4, respectively. The results validate that our Diff-2-in-1 is a versatile design that can elevate the performance of a wide variety of vision tasks.

Table: Figure 5: Ablation study on different data settings with our Diff-2-in-1. Green line: Performance of the baseline VPD. Yellow line: Performance with our Diff-2-in-1. Gray bars: Improvement in each data setting. Our Diff-2-in-1 could consistently bring performance gain for all different data settings with more benefits in mid-range data settings.

### 5.3 Ablation Study

In this section, we offer a better understanding of the superiority of our Diff-2-in-1 by answering the three primary questions. More ablations are included in Section B in the appendix.

How does timestep $T$ in data creation affect final performance? As illustrated in Figure 4, the timestep $T$ balances the trade-off between the content variation and domain shift of the generated data. We ablate different timesteps $T\in\{300,600,800\}$ in the experiments on surface normal instantiated on Bae et al. () and iDisc (Piccinelli et al., ). The results in Table 5 indicate that we achieve the best performance when $T=600$, with a balance of data diversity and quality. Nevertheless, it is noteworthy that our performance is generally robust to different choices of $T$.

How robust is Diff-2-in-1 for domain shift?
We perform the cross-domain evaluation to show that our Diff-2-in-1 has strong generalizability. We train both the baseline Bae et al. () and our Diff-2-in-1 on the ScanNet (Dai et al., ) dataset for the surface normal estimation task, and evaluate the performance on the test set of NYUv2 (Silberman et al., ; Ladicky et al., ). Interestingly, with the results shown in Table 6, we find that the performance of our method trained on ScanNet even outperforms the baseline Bae *et al*. trained on NYUv2, suggesting the generalizability of our method to unseen datasets and its great potential in real practice.

How Diff-2-in-1 is helpful in different data settings? We ablate different settings when the number of available training samples for Diff-2-in-1 varies to investigate whether it is more helpful in data abundance or data shortage scenarios. We run this ablation for semantic segmentation on the ADE20K dataset: we randomly select 10% (2K) to 90% (18K) samples with 10% (2K) intervals in between, assuming that Diff-2-in-1 only gets access to partial data. In each setting, one additional sample for each image is generated using our data generation scheme.

With the results shown in Figure 5, we offer the following observations: (1) Diff-2-in-1 consistently boosts the performance under all settings, with improvement ranging from 0.8 to 1.4 in mIoU, indicating the effectiveness and robustness of our method. (2) Diff-2-in-1 provides more benefits in the data settings from 40% (8K) to 70% (14K). We analyze the reasons including that when the data are scarce, it is relatively hard to train a good model via Equation 6 to provide high-quality multi-modal synthetic data for self-improvement. On the other hand, when the data are already adequate, there is less demand for more diverse data. Under both scenarios, the benefit of our method is still noticeable yet less significant.

### 5.4 Synthetic Data Evaluation

In addition to Figure 4, we visualize samples generated by our method on NYUD-MT (Silberman et al., ) in Figure 6. Diff-2-in-1 is able to generate high-quality RGB images and precise multi-modal annotations, further facilitating discriminative learning via our self-improvement. More qualitative visualizations can be found in Section C in the appendix. Below, we additionally examine the realism and usefulness of the generated data.

Generated samples serving as data augmentation. We select surface normal estimation as the target task and train an external discriminative model, Bae et al. (), under the following two settings: (1) only use the original 795 samples to train the model until convergence (GT Only); and (2) finetune the converged model in GT Only using the mixture of original samples and generated samples from our Diff-2-in-1 before the self-improving stage (GT + Syn). For (2), we generate 500 synthetic samples with $T=600$ and naively merge them together with the original samples. We report two variants of setting (2) with generated samples before or after the self-improving stage in Table 7.
We have the following observations: firstly, the synthetic samples are capable of boosting the performance of a converged model, indicating that the generated RGB and annotation maps are consistent. Moreover, the generated multi-modal data get refined during the self-improving stage, verifying the effectiveness of our method towards generation.

Synthetic data V.S. real data. In the surface normal task, we replace the 500 generated samples with 500 additional real captured images from NYUv2 raw video clips. The annotations of them are produced by our Diff-2-in-1 on the fly. Then, we use the same training strategy to train Diff-2-in-1. As shown in Table 8, using our generated data achieves comparable performance to using the real captured data, proving the premium quality of the synthetic data.

**Table 7: Comparison between two data settings. GT Only: Use real samples to train Bae et al. () until converges. GT + Syn: Further finetune the converged model with real and synthetic samples. Synthetic data further boost the performance of a converged model, demonstrating their realism.**
| Setting | $11.25^{\circ}$ ($\uparrow$) | $22.5^{\circ}$ ($\uparrow$) | $30^{\circ}$ ($\uparrow$) | Mean ($\downarrow$) | Median ($\downarrow$) | RMSE ($\downarrow$) |
| --- | --- | --- | --- | --- | --- | --- |
| GT Only | 56.6 | 76.8 | 83.0 | 17.2 | 9.3 | 26.6 |
| GT + Syn (Before Self-improving) | 57.5 | 77.1 | 83.3 | 17.1 | 9.1 | 26.5 |
| GT + Syn (After Self-improving) | 57.8 | 77.1 | 83.3 | 17.0 | 9.0 | 26.5 |

**Table 8: Comparison between using generated samples and unlabeled real images in NYUv2 surface normal estimation. Comparable performance proves the premium quality of our generated data.**
| Backbone | Setting | $11.25^{\circ}$ ($\uparrow$) | $22.5^{\circ}$ ($\uparrow$) | $30^{\circ}$ ($\uparrow$) | Mean ($\downarrow$) | Median ($\downarrow$) | RMSE ($\downarrow$) |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Bae et al. () | Synthetic | 67.4 | 83.4 | 88.2 | 13.2 | 6.5 | 22.0 |
| Real | 67.5 | 83.5 | 88.2 | 13.2 | 6.5 | 22.0 |  |
| iDisc (Piccinelli et al., ) | Synthetic | 68.7 | 83.7 | 88.4 | 12.7 | 6.0 | 21.6 |
| Real | 68.7 | 83.7 | 88.4 | 12.8 | 6.0 | 21.5 |  |

## 6 Conclusion

In this paper, we bridge generative and discriminative learning by proposing a unified diffusion-based framework Diff-2-in-1. It enhances discriminative learning through the generative process by creating diverse while faithful data, and gets the discriminative and generative processes to interplay with each other using a self-improving learning mechanism. Extensive experiments demonstrate its superiority in various settings of discriminative tasks, and its ability to generate high-quality multi-modal data characterized by both realism and usefulness. More discussions about limitations and future work can be found in Section D in the appendix.

## Appendix A Implementation Details

### A.1 Architecture Details

Feature extraction from diffusion models. We first describe how we extract features for downstream dense prediction tasks from the pretrained stable diffusion model (Rombach et al., ) in our framework, which is generally applicable to all the model instantiations discussed below. We take the latent vector obtained from the VAE encoder in stable diffusion as input for the denoising network, followed by a one-step denoising to obtain the features. Since the denoising operation in stable diffusion is realized by a U-Net (Ronneberger et al., ) module, multi-scale features can be obtained through the one-step denoising process for a given image. As we use the publicly released stable diffusion pretrained weight Stable Diffusion v1-5 which is finetuned on $512\times 512$ resolution, the input images are also resized to $512\times 512$ before being processed by our model. Therefore, the raw multi-scale features $\{f^{\textrm{raw}}_{i}\}_{i=0}^{3}$ extracted from our model are in the spatial resolutions of $8\times 8$, $16\times 16$, $32\times 32$, and $64\times 64$. Following Li et al. (), for each pair of features $f^{\textrm{raw}}_{i-1},f^{\textrm{raw}}_{i}(1\leq i\leq 3)$ with adjacent resolutions, we upsample the lower-resolution feature to the higher-resolution one, concatenating them, and processing with a convolutional layer:

$$ $f^{\textrm{proc}}_{i}=\textrm{Conv}(\textrm{Up}(f^{\textrm{raw}}_{i-1}),f^{ \textrm{raw}}_{i}).$ (9) $$

Then, we get the processed multi-scale features $\{f^{\textrm{proc}}_{i}\}_{i=1}^{3}$ which are further used for fitting into the specific network architectures when we build our Diff-2-in-1 on existing works.

Surface normal estimation. For both Bae et al. () and iDisc (Piccinelli et al., ), the surface normal maps are decoded from multi-scale features extracted by their original encoder. When instantiating our Diff-2-in-1 upon them, we replace their original encoders with the unified model described above. If the decoder requires a feature map with a spatial resolution unavailable in $\{f^{\textrm{proc}}_{i}\}_{i=1}^{3}$, we use a similar strategy as Equation 9 to obtain the feature of a new spatial resolution. If the features required are of higher resolution than the existing features, then we increase the resolution range of the features by

$$ $f^{\textrm{proc}}_{i+1}=\textrm{Conv}(\textrm{Up}(f^{\textrm{proc}}_{i}), \textrm{Deconv}(f^{\textrm{proc}}_{i})),$ (10) $$

where the upsampling and deconvolutional (Noh et al., ) layers increase the feature size by the same ratio. For obtaining lower resolution features, we simply replace the upsampling and deconvolutional layers in Equation 10 with downsampling and convolutional layers. The upsampling or downsampling factor in Equation 10 is set to 2. Moreover, we can iteratively perform Equation 10 multiple times if the required features are more than twice larger or smaller than the features $\{f^{\textrm{proc}}_{i}\}_{i=1}^{3}$ from the pretrained stable diffusion model.

Semantic segmentation. As VPD (Zhao et al., ) also builds upon stable diffusion (Rombach et al., ), we directly apply the self-improving algorithm in our Diff-2-in-1 on VPD to boost its performance.

Multi-task learning. The decoder of InvPT (Ye & Xu, ) requires multi-scale features. Therefore, we use the same strategy as the surface normal estimation methods (Bae et al., ; Piccinelli et al., ) to provide the decoder with the required features. The decoder of TaskPrompter (Ye & Xu, ) only requires single-scale features. Therefore, we use Equation 10 to resize all the features in $\{f^{\textrm{proc}}_{i}\}_{i=1}^{3}$ to this specific scale. As a result, the multi-scale knowledge extracted from stable diffusion can be injected into the TaskPrompter framework. Additionally, both InvPT and TaskPrompter adopt pretrained ViT (Dosovitskiy et al., ) or Swin Transformer (Liu et al., ) as their encoders. To better utilize the prior knowledge within the original encoders, we merge the knowledge from the two sources by adding the features from stable diffusion to their original encoders.

Summary. From the instantiations above, we have the following guidelines for converting existing methods to the unified diffusion-based models in our Diff-2-in-1: (1) By default, we replace the encoders in the original models with the stable diffusion feature extractor; (2) If the features required by the original decoder is unavailable in the multi-scale features, we can use Equation 10 to expand the range of the multi-scale features; (3) If the original model design contains a pretrained encoder, we consider merging the knowledge of the stable diffusion model and the pretrained encoder.

### A.2 Text Prompts

Our Diff-2-in-1 uses the generative nature of diffusion models to create samples, which requires text prompts as conditions during the denoising process to generate high-quality samples. However, the text prompts are not always available in our target datasets. To solve this challenge, we use the off-the-shelf image captioning model BLIP-2 (Li et al., ) to generate text descriptions for each image. The generated text descriptions serve as conditions when performing denoising to generate new data samples with our Diff-2-in-1. We further show in the ablation study in Section B that the choice of the image captioning model has little influence on the performance.

### A.3 Additional Training Details

In the warm-up stage, we follow the same hyperparameters of the learning rate, optimizer, and training epochs of the original works that our Diff-2-in-1 builds on. In the self-improving stage, the exploitation parameter $\theta_{E}$ continues the same training scheme in the warm-up stage, while the creation parameter $\theta_{C}$ updates once when $\theta_{E}$ consumes 40 samples. Thus, the interval of the EMA update for $\theta_{C}$ depends on the batch size used in the self-improving stage. For the surface normal estimation and semantic segmentation tasks, we adopt a batch size of 4, so the EMA update happens every 10 iterations. For the multi-task frameworks, the batch size is 1, so we perform the EMA update every 40 iterations. The momentum hyperparameter $\alpha$ for the EMA update is set as 0.999 for multi-task learning on PASCAL-Context (Mottaghi et al., ), and 0.998 for the rest of the task settings.

Figure: Figure A: Captions generated by ClipCap (Mokady et al., ) and BLIP-2 (Li et al., ) on the NYUv2 (Silberman et al., ) dataset. The generated captions using these two off-the-shelf image captioning models not only have similar semantic meanings, but also share similar text formats.
Refer to caption: x7.png

**Table A: Ablation study on using text prompts from different off-the-shelf image captioning models ClipCap (Mokady et al., ) and BLIP-2 (Li et al., ) to generate samples with Diff-2-in-1. The evaluation is conducted on the surface normal estimation task on the NYUv2 (Silberman et al., ; Ladicky et al., ) dataset. Our Diff-2-in-1 is robust to different choices of image captioning models. Nevertheless, it is necessary to have an image captioning model to provide text prompts in the denoising process during data generation.**
| Model | Caption | $11.25^{\circ}$ ($\uparrow$) | $22.5^{\circ}$ ($\uparrow$) | $30^{\circ}$ ($\uparrow$) | Mean ($\downarrow$) | Median ($\downarrow$) | RMSE ($\downarrow$) |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Diff-2-in-1 on Bae et al. () | None | 66.0 | 83.0 | 88.0 | 13.6 | 7.0 | 22.0 |
| ClipCap (Mokady et al., ) | 67.3 | 83.4 | 88.2 | 13.2 | 6.5 | 22.0 |  |
| BLIP-2 (Li et al., ) | 67.4 | 83.4 | 88.2 | 13.2 | 6.5 | 22.0 |  |
| Diff-2-in-1 on iDisc (Piccinelli et al., ) | None | 67.2 | 83.4 | 88.1 | 13.0 | 6.6 | 21.7 |
| ClipCap (Mokady et al., ) | 68.7 | 83.7 | 88.4 | 12.7 | 6.0 | 21.6 |  |
| BLIP-2 (Li et al., ) | 68.7 | 83.7 | 88.4 | 12.7 | 6.0 | 21.6 |  |

## Appendix B Additional Ablation Study

What text prompts to use for the unified diffusion model? As mentioned in Section A.2, we adopt BLIP-2 to generate text prompts for creating new samples based on the reference images. What if the text prompters are less powerful? We show that different choices of image captioning models have a marginal influence on the performance of our Diff-2-in-1. We first show the captions generated by BLIP-2 and another relatively weaker model ClipCap (Mokady et al., ) in Figure A. The captions generated by these two off-the-shelf models have similar semantic meanings, as well as sharing similar formats of “A [Place] with [Object 1], [Object 2], …, [Object N-1], and [Object N].” We further evaluate the performance of using the text prompts from ClipCap and BLIP-2 to generate synthetic samples for the self-improving learning system in Diff-2-in-1. The results are shown in Table A. We can observe that once again there is no large difference between the two variants and both of them greatly outperform the baseline, demonstrating that our Diff-2-in-1 is robust to different text prompters used during the denoising process for data generation. Nonetheless, it does not indicate that the image captioning model is dispensable. If we completely get rid of the image captioning model and do not use text as the condition during denoising (None for Caption in Table A), we could observe an evident drop in the performance on discriminative tasks.

Should we finetune the diffusion backbone? As shown in Figure 3, if the generation process of our unified diffusion model starts from Gaussian noise, the generated samples will have an evident domain shift from the original distribution. Therefore, we adopt the halfway diffusion-denoising mechanism to synthesize in-distribution data. Another potential solution to overcome the domain shift issue is to finetune the stable diffusion backbone. We test this setting with two finetuning strategies for a comprehensive ablation: (1) directly finetune all the parameters of the denoising U-Net (Direct Finetuning); (2) adopt parameter-efficient finetuning strategy Low-Rank Adaptation (LoRA) (Hu et al., ) on the denoising modules of stable diffusion (LoRA Finetuning). We conduct the experiments on the surface normal task on the NYUv2 dataset with Bae et al. () as the task head. The results are shown in Table B. The inferior performance of using the finetuned stable diffusion indicates that the diffusion-denoising data generation scheme and the self-improving learning system in our Diff-2-in-1 are essential. One factor for the unsatisfactory performance of using finetuning is that the finetuning process incurs a loss in the generalization capability, especially during finetuning with limited data (*e.g*., 795 samples on NYUv2), making the features extracted from the stable diffusion model less informative for decoding visual task predictions. In comparison, our proposed diffusion-denoising data generation scheme injects external knowledge from the pretrained stable diffusion model to the samples in the training data, without risks of knowledge forgetting with respect to its discriminative ability.

**Table B: Ablation study on strategies to finetune the diffusion backbone. Direct Finetuning: Directly finetune the denoising U-Net. LoRA Finetuning: Adopt LoRA (Hu et al., ) to finetune the U-Net. Their unsatisfactory results indicate that the features extracted from the finetuned network are less informative and have worse generalizability. The information loss introduced by finetuning is inevitable even if using the parameter-efficient finetuning technique LoRA to mitigate forgetting. In contrast, our diffusion-denoising strategy injects external knowledge from the pretrained stable diffusion to the samples, without risks of forgetting the discriminative ability of diffusion models.**
| Setting | $11.25^{\circ}$ ($\uparrow$) | $22.5^{\circ}$ ($\uparrow$) | $30^{\circ}$ ($\uparrow$) | Mean ($\downarrow$) | Median ($\downarrow$) | RMSE ($\downarrow$) |
| --- | --- | --- | --- | --- | --- | --- |
| Direct Finetuning | 58.0 | 76.5 | 82.4 | 16.9 | 8.7 | 26.5 |
| LoRA Finetuning | 64.8 | 82.0 | 87.4 | 14.1 | 7.3 | 22.8 |
| Diff-2-in-1 (Ours) | 67.4 | 83.4 | 88.2 | 13.2 | 6.5 | 22.0 |

What timestep $T$ to choose for discriminative feature extraction? In our current experiments, we follow existing works ODISE (Xu et al., ) and VPD (Zhao et al., ) to adopt $T=0$ as the timestep for feature extraction from the pretrained stable diffusion model. We ablate different timesteps $T$ for extracting features from stable diffusion in Table C. The performance is generally satisfactory with relatively small timesteps $T$, which add little noise to the clean latents before extracting features from denoising U-Net. We do not attentively optimize for the best $T$ and it is likely that a better $T$ may exist in other settings which can further improve the performance of our Diff-2-in-1. We leave the exploration of optimal $T$ for different tasks as future work.

**Table C: Ablation study on extracting features from the pretrained stable diffusion model with different timesteps $T$ on NYUv2 surface normal evaluation. Our Diff-2-in-1 achieves better performance with smaller $T$ in this task setting.**
| $T$ | $11.25^{\circ}$ ($\uparrow$) | $22.5^{\circ}$ ($\uparrow$) | $30^{\circ}$ ($\uparrow$) | Mean ($\downarrow$) | Median ($\downarrow$) | RMSE ($\downarrow$) |
| --- | --- | --- | --- | --- | --- | --- |
| 0 | 67.4 | 83.4 | 88.2 | 13.2 | 6.5 | 22.0 |
| 50 | 67.5 | 83.3 | 88.1 | 13.2 | 6.5 | 22.0 |
| 100 | 66.9 | 82.6 | 87.5 | 13.5 | 6.5 | 22.4 |
| 150 | 65.5 | 81.6 | 86.7 | 14.0 | 6.8 | 23.0 |

**Table D: Ablation study on different $\alpha$ for the EMA update within Diff-2-in-1. $\alpha=0.998$ reaches the best performance in this setting of surface normal prediction with Bae et al. () on NYUv2. Nonetheless, our Diff-2-in-1 is robust to different $\alpha$ within a broad range.**
| $\alpha$ | $11.25^{\circ}$ ($\uparrow$) | $22.5^{\circ}$ ($\uparrow$) | $30^{\circ}$ ($\uparrow$) | Mean ($\downarrow$) | Median ($\downarrow$) | RMSE ($\downarrow$) |
| --- | --- | --- | --- | --- | --- | --- |
| N/A (Baseline) | 62.2 | 79.3 | 85.2 | 14.9 | 7.5 | 23.5 |
| 0.99 | 67.1 | 83.2 | 88.1 | 13.4 | 6.6 | 22.1 |
| 0.993 | 67.3 | 83.4 | 88.2 | 13.3 | 6.6 | 22.0 |
| 0.996 | 67.3 | 83.4 | 88.2 | 13.3 | 6.6 | 22.0 |
| 0.998 | 67.4 | 83.4 | 88.2 | 13.2 | 6.5 | 22.0 |
| 0.999 | 67.1 | 83.3 | 88.1 | 13.3 | 6.7 | 22.1 |

How to choose hyperparameters for the EMA update? We ablate the choice of $\alpha\in[0.99,0.999]$ for the EMA update according to guidelines in Liu et al. (). The results with Bae et al. () on the NYUv2 (Silberman et al., ; Ladicky et al., ) surface normal task are shown in Table D where $\alpha=0.998$ achieves the best performance. Nevertheless, the performance of our Diff-2-in-1 is robust to different choices of $\alpha$ within a broad range.

## Appendix C More Visualizations

We provide more qualitative results from the following two aspects: (1) performance comparison with state-of-the-art methods on discriminative tasks and (2) multi-modal data generation quality of the synthetic samples from our Diff-2-in-1.

### C.1 Comparisons on Discriminative Tasks

The qualitative comparisons of our Diff-2-in-1 and the baselines are shown in Figures B, C (surface normal prediction) and D (multi-task). Our Diff-2-in-1 outperforms the baselines, demonstrating the competence of our unified diffusion-based model in the discriminative perspective.

### C.2 Data Generation Quality

We display the synthetic multi-modal data from our Diff-2-in-1 data creation framework in Figures E, F (RGB-normal pairs) and G, H (RGB and multiple annotations) to show that Diff-2-in-1 has powerful generation ability that is capable of generating high-quality and consistent samples.

## Appendix D Discussions and Future Work

Limitation. One major limitation of this work is that adopting diffusion models for data generation is relatively time-consuming as diffusion models typically need multi-step denoising to produce samples. To alleviate this shortcoming, current advancement on accelerating the inference process of diffusion models (Zheng et al., ; Lu et al., ; Yin et al., ; Liu et al., ) can be adopted to speed up the data generation process.

Future work. Looking ahead, the potential applications of this unified approach are vast. Future research directions include extending this methodology to other types of tasks, such as 3D detection, and refining and optimizing the Diff-2-in-1 framework such as a more efficient data creation scheme and knowledge transfer to a new domain.

Figure: Figure B: Qualitative results on the surface normal prediction task of NYUv2 (Silberman et al., ; Ladicky et al., ). Our proposed Diff-2-in-1 outperforms the baseline with more accurate surface normal estimations, indicating that our unified diffusion-based models excel at handling discriminative tasks. The black regions in the ground truth visualizations are invalid regions.
Refer to caption: x8.png

Figure: Figure C: Qualitative results on the surface normal task of NYUv2 (Silberman et al., ; Ladicky et al., ). Our proposed Diff-2-in-1 outperforms the baseline with more accurate surface normal estimations, indicating that our unified diffusion-based models excel at handling discriminative tasks. The black regions in the ground truth visualizations are invalid regions.
Refer to caption: x9.png

Figure: Figure D: Qualitative results on the multi-task datasets NYUD-MT (Silberman et al., ) and PASCAL-Context (Mottaghi et al., ). Diff-2-in-1 has superior performance compared to the baselines, demonstrating the effectiveness of our unified diffusion-based model design. Zoom in for the regions with bounding boxes to better see the comparison.
Refer to caption: x10.png

Figure: Figure E: Synthetic samples from our method after the Diff-2-in-1 framework is trained on the surface normal task of NYUv2 (Silberman et al., ; Ladicky et al., ). The odd rows are the generated RGB images while the even rows are the generated surface normal maps. The model is capable of generating diverse and high-fidelity images with the corresponding surface normal maps matching the generated RGB images.
Refer to caption: x11.png

Figure: Figure F: Synthetic samples from our method after the Diff-2-in-1 framework is trained on the surface normal task of NYUv2 (Silberman et al., ; Ladicky et al., ). The odd rows are the generated RGB images while the even rows are the generated surface normal maps. The model is capable of generating diverse and high-fidelity images with the corresponding surface normal maps matching the generated RGB images.
Refer to caption: x12.png

Figure: Figure G: Synthetic samples from our method after the Diff-2-in-1 framework is trained on the multi-task setting of NYUD-MT (Silberman et al., ). Each batch of samples contains four rows: RGB, depth map, surface normal map, and semantic labels (from top to bottom). The generated samples are of high quality with their multi-task annotations.
Refer to caption: x13.png

Figure: Figure H: Synthetic samples from our method after the Diff-2-in-1 framework is trained on the multi-task setting of PASCAL-Context (Mottaghi et al., ). Each batch of samples contains five rows: RGB, semantic labels, human parsing labels, saliency map, and surface normal map (from top to bottom). If the human parsing labels are all black, it means that there is no human in the generated image. The generated samples are of high quality with their multi-task annotations.
Refer to caption: x14.png

## Peer Reviews

confidence: 5
contribution: 2
initial_rating: 3
presentation: 3
questions: Questions
It is unclear whether θE and θC represent parameters of the task head alone or include latent diffusion parameters. Is the pre-trained latent diffusion fine-tuned during self-training, or does it remain frozen?

Comments
The paper is missing recent related works. While it explores the self-training of a framework using only VPD, there are more recent studies that apply the diffusion process to discriminative prediction tasks. Extending the idea to these diffusion-based discriminative methods would be an interesting direction.
soundness: 2
strengths: 1.	Unified Framework: The paper integrates generative and discriminative processes to improve discriminative tasks using the diffusion model.
2.	Favorable performance on benchmarks: The method is evaluated on NYUD-MT and PASCAL-Context, and shows consistent performance improvements.
summary: The paper presents Diff-2-in-1, a framework leveraging diffusion models for both multi-modal data generation and dense visual perception tasks. Unlike previous works that treat diffusion models as standalone components for perception or data augmentation, Diff-2-in-1 integrates generative and discriminative learning through a self-improving mechanism using EMA update. This mechanism involves two sets of parameters: one for data creation (θC) and another for data exploitation (θE). The training process iteratively enhances both generation and discriminative task performance with backpropagation and EMA update.
weaknesses: 1.	The term “unified framework” is overstated and potentially misleading. The proposed method does not employ a single model to handle both data generation and prediction. Instead, it uses a pre-trained latent diffusion model for RGB image generation and a separate task-specific head for discriminative tasks. While there is interaction between these components during the update process, the term “unified” suggests a more cohesive integration than what is presented. From the description, it is likely to be expected that the model to perform both data generation and discriminative tasks by denoising process. Clarifying this would better align reader expectations with the actual implementation.
2.	Clarity. It is unclear whether θE and θC represent parameters of the task head alone or include latent diffusion parameters. 
3.	Limited Novelty in Core Components: While the integration of generative and discriminative learning is an interesting direction, the core underlying techniques are adaptations of existing methods. The generation component relies on the widely used latent diffusion model, while the discriminative part uses VPD, a previously proposed method. The main technical contribution lies in the self-training mechanism using EMA updates, which is a general concept that could be applied to various ML tasks. The technical contribution and the motivation behind the problem are not well connected.
4.	Incomplete literature survey.
There have been recent works [1][2][3] on tackling discriminative tasks using the denoising process. These works are closely relevant but not mentioned nor discussed. These works should be discussed.
[1] Ke, Bingxin, et al. "Repurposing diffusion-based image generators for monocular depth estimation." Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2024.
[2] Liu, Xian, et al. "Hyperhuman: Hyper-realistic human generation with latent structural diffusion." arXiv preprint arXiv:2310.08579 (2023).
[3] Fu, Xiao, et al. "GeoWizard: Unleashing the Diffusion Priors for 3D Geometry Estimation from a Single Image." arXiv e-prints (2024): arXiv-2403.
5.	Unrelated works in the related work section. The related work section has two subsections. While the second subsection discusses relevant prior studies, the first subsection, titled “Pixel-level dense visual perception,” includes a list of works that are not relevant to the contributions of this paper. 
6.	Minor Performance Gain: Performance gains over existing augmentation methods such as DA-Fusion are marginal.

---

confidence: 5
contribution: 3
initial_rating: 6
presentation: 2
questions: See [Weaknesses] part
soundness: 3
strengths: 1. The approach of using synthetic data pairs and integrating a self-improving mechanism is interesting and valuable for discriminative tasks using pre-trained diffusion models.
2. The method shows promise in scenarios with limited training data.
3. Comprehensive experiments and ablation studies across multiple dense prediction tasks (surface normal estimation, semantic segmentation, depth estimation) and multiple datasets demonstrate the effectiveness and versatility of the approach.
summary: This paper introduces Diff2in1, a method to enhance discriminative capability by generating diverse and faithful synthetic data, particularly beneficial for discriminative learning with limited training data. The authors propose a self-improving learning mechanism that leverages synthetic data. Experiments and ablation studies demonstrate the effectiveness of the proposed method.
weaknesses: 1. The overall writing lacks clarity. The paper's main focus is on improving discriminative learning using synthetic data. Claiming it as "A single, unified diffusion-based model for both generative and discriminative learning" may be not proper, as the method does not improve generative learning.
2. The method section should clearly state which parameters are trained or frozen during different stages.
3. Figure 2 needs clarification. If understood correctly, in the left subfigure, the data creation corresponds to discriminative learning, with input and output corresponding to the generative learning in the right figure.
4. It's unclear whether the proposed method works with fully fine-tuned models for depth estimation, such as DepthCrafter and GeoWizard.
5. The synthetic data generated with SDEdit may only exploit data similar to the dataset, potentially limiting its ability to generate significantly different objects. It's unclear how the method improves discriminative capability on data with large domain shifts.

---

confidence: 4
contribution: 4
initial_rating: 8
presentation: 4
questions: 1. It can be observed that Taskprompter achieve better result for Saliency in Table.4. Why does the performance of Taskprompter decrease after adding Diff-2-to-1 to Taskprompter?
soundness: 4
strengths: 1. The authors propose a novel method with self-improving mechanism to bridge high-fidelity image synthesis and dense visual perception tasks.
2. The paper is well-written and the structure is well-organized and easy to follow.
3. The authors conduct extensive experiments and ablation studies to demonstrate the superiority of their designs, providing impressive qualitative and quantitative results.
summary: The authors present Diff-2-in-1, a unified framework that seamlessly integrates multimodal generation with discriminative dense visual perception using diffusion models. With a self-improving mechanism, multi-modal generation can be progressively enhanced in a self-directed manner. Extensive experiments show that Diff-2-in-1 achieves superior performance consistently across various discriminative backbones and generate high-quality multi-modal data.
weaknesses: 1. The content of preliminary can be appropriately reduced, and add several visual comparisons from the appendix to the main paper.
2. It can be observed from Table.2 that the Diff-2-in-1 only improve the diffusion-based the segmentation method by 0.5, which seems to be incremental. Please explain the reason.

---

confidence: 4
contribution: 2
initial_rating: 8
presentation: 3
questions: In summary, the paper has the potential to be a qualified paper for ICLR. However, there are some major concerns as disccused above. If authors can address some of them, I will consider raising my rating.
soundness: 3
strengths: 1. This paper creates a unified diffusion model for unifying discriminative and generative tasks.
2. The writing of this paper is clear and easy to understand.
summary: The paper introduces a framework that unifies generative and discriminative tasks within diffusion models. The framework enables simultaneous handling of multi-modal data generation and dense visual perception, by leveraging a diffusion-denoising approach to enhance both tasks. By creating synthetic data through a self-improving mechanism, the framework aims to boost the performance of dense visual perception tasks, particularly in low-data settings. Experimental results show improvements in state-of-the-art performance across various dense vision tasks, including semantic segmentation, depth estimation, and surface normal prediction.
weaknesses: 1. The proposed framework is limited to dense perception tasks such as segmentation, as the outputs are generated by diffusion models. Can it achieve other types of perception tasks such as categorization, instance segmentation, object detection, or text captioning?

2. The cycle of discriminative and generative learning in this framework only improves perception tasks but not generative tasks. I expect to see more discussions or experiments on how the framework can leverage multimodal information to improve RGB image generation.

3. Image generation performance has not been studied in the paper.

4. The self-imrpoving mechanism is one of the two major contributions of this work. I didn't see ablation study on using/not using it. It requires detailed ablation study on it to further reveal its effectiveness.

5. The performance improvement on semantic semgnetation and depth estimation is not significant compared to normal prediction. Could authors try to interpret this?

---

confidence: 3
contribution: 3
initial_rating: 5
presentation: 1
questions: I have no further questions.
soundness: 3
strengths: 1. The idea of merging both data generation and visual perception into one unified framework is interesting and novel.
2. The method is versatile enough to handle multiple tasks such as segmentation, depth estimation and surface normals estimation. demonstrating wide applicability in many downstream tasks.
summary: The paper proposes a new diffusion-based framework called Diff-2-in-1, which integrates both multi-modal data generation and dense visual perception. Unlike most prior work where diffusion models are used in isolated manners (either for generating data or for perception tasks), the authors introduce a unified approach that leverages the denoising process of diffusion models to simultaneously perform both tasks.
weaknesses: 1. Both the figure (Figure 2) and writing for the section of self-improving learning are bad and seem to not be well-motivated. The performance gain of self-improving learning is not good either as the scores for most metrics remain unchanged (in Table 7)).

2. There is no clear breakdown of which components of the self-improving mechanism or the diffusion-denoising process contribute most to the observed improvements. An ablation study would help pinpoint the critical aspects of the framework. For example, performing an additional experiment without using the diffusion-denoising process.

3. For depth and surface normal estimation, the authors do not compare their method against Marigold [1] and StableNormal [2], which are very powerful models for these tasks

Reference:

[1] Ke et. al. Repurposing Diffusion-Based Image Generators for Monocular Depth Estimation. 2024 

[2] Ye et. al. StableNormal: Reducing Diffusion Variance for Stable and Sharp Normal. 2024

Meta-review: The paper presents a diffusion-based framework designed to address multi-modal data generation and dense visual perception tasks. This approach leverages the diffusion-denoising process to enhance discriminative visual perception through the generation of multi-modal data that closely mimics the distribution of the original training set. It has been validated across a variety of discriminative backbones, demonstrating consistent performance improvements and high-quality multi-modal data generation.

***Strengths:***
- The framework successfully integrates generative and discriminative processes, optimizing the use of synthetic data for improved performance in discriminative tasks.
- Demonstrated effectiveness across multiple datasets and tasks, including NYUD-MT and PASCAL-Context, with consistent improvements over existing methods.
- Comprehensive experiments and ablation studies showcase the framework's versatility and effectiveness in enhancing discriminative learning with synthetic data.

***Weaknesses:***
There are shared concerns wrt the method clarity of this paper. Many details were initially unclear but have been improved post-rebuttal.
Lack of discussion and comparison with most recent literature. This one has also been improved after rebuttal. 

The authors effectively addressed many of the concerns raised during the review process, enhancing the clarity and depth of their manuscript. Despite some initial shortcomings in clarity, the revised version and the authors' responses to the reviews have addressed these issues, leading to a better understanding and appreciation of the work's contributions. After careful consideration and discussion, we are delight to inform this paper is accepted.

Decision: Accept (Poster)