Paper: EmerDiff: Emerging Pixel-level Semantic Knowledge in Diffusion Models (ICLR-2024)

Reviewer comment (Evaluation):
While we would love to unlock the perception of SD, I find this article's approach to be inelegant and not performing well.

Author response:
One of the purposes of building our image segmentor is to visualize pixel-level semantic understanding of pre-trained diffusion models. In the previous works, segmentation with diffusion models was typically achieved by incorporating additional training on segmentation datasets, which, however, blurred how much pre-trained diffusion models alone understand pixel-level semantic relations. Our image segmentor, which is solely built on the pre-trained diffusion models without any additional training, has revealed that the pre-trained diffusion models already possess highly accurate pixel-level semantic knowledge, which provides an important insight into the current research trends of "unlocking the perception of" generative models.

Reviewer comment (Experiments):
Some of the existing solutions also have no comparison at all (such as INSTRUCTCV).

Author response:
Following that, we did not include the comparison with the existing methods that require additional supervision with segmentation datasets, including DatasetDDPM [1], ODISE [2], and INSTRUCTCV. We kindly remind that INSTRUCTCV is a concurrent work released on arXiv after the ICLR submission deadline, and therefore we were not able to cite it in our paper. We are planning to mention it in the related work section.

Reviewer comment (Experiments):
This approach using many sensitive hyper-parameters, which is need to be tuned very carefully for each dataset. It is not easy for large dataset and we don't have a validation set.

Author response:
We kindly remind that we use the **same hyper-parameters for all the datasets** (COCO-Stuff, PASCAL-Context, ADE20K, and Cityscapes). Although laborious hyperparameter tuning has been the common issue in the literature of unsupervised semantic segmentation (e.g. STEGO [1]), we avoid this problem by utilizing the powerful generative model (i.e. Stable Diffusion) trained on images of diverse domains.

Reviewer comment (Experiments):
Although the paper shows the ablation study for choosing some hyper-parameters, it stills lacks some others such as the level of cross-attention layer for low-resolution feature map, modulating timestep (should have quantitative numbers)

Author response:
We appreciate your suggestions. We have included the additional results in Appendix D (highlighted in red).

Regarding the selection of cross-attention layers to build low-resolution segmentation maps, our choice of $16 \times 16$ resolution is based on the previous observation (e.g. Figure7 of [8])  that the layers at $16 \times 16$ resolution are most semantically informative. Since there are three cross-attention layers at $16 \times 16$, we additionally experimented with the effects of varying the choice of these three layers. It turns out that the choice amoung these three layers does not differentiate the performance (mIOU: 33.1, 33.1, 32.8, respectively), which is also reported in Table 5.

For the modulated timesteps, we have added the quantitative analysis in Table 7.  Our results are consistent with the qualitative results, and modulating at an early-middle timestep achieves the best performance. We note that there is some flexibility in choosing the modulation timesteps $t_m$. For example, in our experiments, both $t_m = 281$ and $t_m = 481$ attain the same best performance.

Reviewer comment (Evaluation):
The resulting segmentation seems to be over-segmented (Fig. 1), sometimes just like superpixels, still need semantic segmentation labels to align and group these over-segmentation regions to have meaningful masks, it is different from SAM.

Author response:
In Figure 1, we deliberately set the number of masks high (e.g. 30) for visualization purposes. As demonstrated later in Figure 5, if we keep the number of segmentation masks low, we can easily confirm the semantic awareness of the obtained segmentation maps, which is different from superpixels. 

As an example to contextualize our obtained segmentation masks without any segmentation labels, we have experimented with the task of annotation-free open-vocabulary semantic segmentation (Please see Figure 7), where we use the off-the-shelf image encoder (e.g. CLIP) trained on image-text pairs to produce text-aligned embeddings for each mask. By associating the produced masks with the text embeddings, we overcome the issue of over-segmentation.

Reviewer comment (Evaluation):
Can the authors provide comparisons of the runtime between different methods in Table 2?

Author response:
Due to time constraints, we were not able to provide the runtime comparison in Table 2. However, we have included the discussion about the runtime in Section 4.1 (highlighted in blue). We hope that this addresses your concerns about the runtime of our method. Admittedly, the runtime is a disadvantage of diffusion-based methods, but we expect this to be significantly faster in the future as there is a lot of active research in speeding up diffusion models.

Reviewer comment (Novelty):
The proposed method is not too novel in terms of the main idea. Transforming internal UNet feature representations into segmentation maps via K-means was explored in prior work (e.g., Baranchuk et al, Fig 4), although perhaps not in the context of Stable Diffusion. The modification to make it work with SD (Sec. 3.3) makes sense and works, but is not particularly educating or insightful, to my opinion.

Author response:
Our method is indeed motivated by the previous observation that applying k-means on specific intermediate feature representations yield semantically meaningful clusters (as mentioned in the second paragraph of the introduction section). However, for many classes of generative models (LDMs, DMs, GANs), these semantically useful features are spatially low dimensional. For instance, Figure 4 of Baranchuk et al [1] suggests only features with a resolution of $64 \times 64$ or lower in guided diffusion (DM) yield semantically interpretable clusters, whereas the image resolution of the model is $256 \times 256$. This phenomenon is also observed in StyleGAN (Figure 9-12 in the appendix of [2]). Therefore, the problem of "mismatch in resolutions" is not specific to LDMs, and extracting pixel-level semantic relations from such generative models is a non-trivial task. To the best of our knowledge, we are the first to tackle this problem with Stable Diffusion. 

As you have pointed out, our primary contribution is Section 3.3, where we show that the semantic knowledge formed in the spatially lower-dimensional layers can be accurately rendered onto the image pixel space by realizing the correspondences between the low-dimensional feature space and image pixels. Despite the simplicity of our idea, it significantly facilitates the visualization and interpretation of lower-dimensional feature maps (Please see Figure 4 of our work). Our work utilizes this technique to demonstrate that the lower-dimensional feature representations of SD are strongly tied with the semantic objects in the image, which provides an important insight to the research community that utilizes internal representations of diffusion models for discriminative tasks [1][3][4].

Reviewer comment (Novelty):
Overall, the inventive step of the method is strongly tailored for the family of Stable Diffusion models. Although this makes sense as many state-of-the-art DMs belong to this family, the method still may become not so much applicable in case of other types of DMs.

Author response:
Semantically meaningful feature representations are commonly observed inductive biases in many generative models, including LDMs, DMs, and GANs [2]. However, in all cases, such feature representations are of lower resolutions than the image resolution. 

Although we leave experimenting with other types of generative models for future work, our core idea of measuring "how much the final pixel values depend on different masked feature areas" by perturbing the values of the sub-regions of the feature maps should technically apply to all these models. Specifically, we believe our pipeline does not contain any parts that are "strongly" tied to the model being a latent diffusion model. We are curious to know which part you believe to be strongly tailored for the family of latent diffusions.

Reviewer comment (Experiments):
[Xu et al, CVPR23] noted that using pre-trained SD with zero text input is suboptimal for feature extraction. Did the authors observe any suboptimalities in using zero text line as inputs, or did they experiment with providing textual descriptions to the model?

Author response:
For this project, our aim was to extract pixel-level semantic knowledge without relying on any additional training or supervision. As such, we didn't provide any textual descriptions in our experiments, and we found that even without captions it yields good results. This finding is in line with Xu et al [3] (Table 4), where they achieved similarly strong performance without injecting meaningful captions. 
Combining this method with an automatic image-captioning model could be an interesting direction which we leave to future work.

Reviewer comment (Experiments):
Since one needs to change the values of every sub-region of low-resolution feature maps and examine the changes in the corresponding generated images, the whole process may take much time.

Author response:
Dear Reviewer D7CR,

We thank you for your constructive feedback.

Below we address your concerns about the runtime:

> Since one needs to change the values of every sub-region of low-resolution feature maps [...] the whole process may take much time.

> Is there a more elegant way to establish the correspondence [...], but requires much time (I think).

Indeed, our method requires running the independent modulated denoising process for each mask, which may take much time with the naive implementation. A straightforward optimization would be parallelizing the modulated denoising processes, which is effective as the denoising processes do not involve backpropagation. Additionally, the modulated denoising processes are only required to start from the timestep to apply modulation (i.e. modulated timestep $t_{m}$). Since our paper sets $t_{m} = 281$ (out of $T=1000$) under DDPM sampling scheme of $50$ steps, it only requires up to $15$ steps to run each modulated denoising process. However, we agree that our method is still computationally expensive and would love to see whether further optimization is possible, which we leave for future work.

As you have pointed out, our primary focus was to present the key finding that "changing the values of a sub-region of low-resolution feature maps triggers the notable value changes of values in semantically related regions of the generated images", which enables better visualization and interpretation of semantically meaningful low-dimensional feature maps (Please see Figure 4 (or  Figure 1 of [2]) for a comparison against the naive upsampling approach).  We utilize this technique to demonstrate that the low-dimensional feature representations are highly accurately tied with the semantic objects in the image, which provides an important insight into the current research trends of utilizing internal representations of diffusion models for discriminative tasks [1][2][3].

References:

[1] Dmitry Baranchuk, Andrey Voynov, Ivan Rubachev, Valentin Khrulkov, and Artem Babenko. Labelefficient semantic segmentation with diffusion models. In International Conference on Learning
Representations, 2022.

[2] Jiarui Xu, Sifei Liu, Arash Vahdat, Wonmin Byeon, Xiaolong Wang, and Shalini De Mello. Openvocabulary panoptic segmentation with text-to-image diffusion models. In Proceedings of the
IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2955–2966, 2023.

[3] Daiqing Li, Huan Ling, Amlan Kar, David Acuna, Seung Wook Kim, Karsten Kreis, Antonio Torralba, and Sanja Fidler. Dreamteacher: Pretraining image backbones with deep generative models,
2023.

Reviewer comment (Experiments):
Is there a more elegant way to establish the correspondence between the semantically related pixels and the sub-region in low-resolution feature maps. The current way of changing the the values in every sub-region of low-resolution feature maps and examining the changes in generated images works, but requires much time (I think).

Author response:
Dear Reviewer D7CR,

We thank you for your constructive feedback.

Below we address your concerns about the runtime:

> Since one needs to change the values of every sub-region of low-resolution feature maps [...] the whole process may take much time.

> Is there a more elegant way to establish the correspondence [...], but requires much time (I think).

Indeed, our method requires running the independent modulated denoising process for each mask, which may take much time with the naive implementation. A straightforward optimization would be parallelizing the modulated denoising processes, which is effective as the denoising processes do not involve backpropagation. Additionally, the modulated denoising processes are only required to start from the timestep to apply modulation (i.e. modulated timestep $t_{m}$). Since our paper sets $t_{m} = 281$ (out of $T=1000$) under DDPM sampling scheme of $50$ steps, it only requires up to $15$ steps to run each modulated denoising process. However, we agree that our method is still computationally expensive and would love to see whether further optimization is possible, which we leave for future work.

As you have pointed out, our primary focus was to present the key finding that "changing the values of a sub-region of low-resolution feature maps triggers the notable value changes of values in semantically related regions of the generated images", which enables better visualization and interpretation of semantically meaningful low-dimensional feature maps (Please see Figure 4 (or  Figure 1 of [2]) for a comparison against the naive upsampling approach).  We utilize this technique to demonstrate that the low-dimensional feature representations are highly accurately tied with the semantic objects in the image, which provides an important insight into the current research trends of utilizing internal representations of diffusion models for discriminative tasks [1][2][3].

References:

[1] Dmitry Baranchuk, Andrey Voynov, Ivan Rubachev, Valentin Khrulkov, and Artem Babenko. Labelefficient semantic segmentation with diffusion models. In International Conference on Learning
Representations, 2022.

[2] Jiarui Xu, Sifei Liu, Arash Vahdat, Wonmin Byeon, Xiaolong Wang, and Shalini De Mello. Openvocabulary panoptic segmentation with text-to-image diffusion models. In Proceedings of the
IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2955–2966, 2023.

[3] Daiqing Li, Huan Ling, Amlan Kar, David Acuna, Seung Wook Kim, Karsten Kreis, Antonio Torralba, and Sanja Fidler. Dreamteacher: Pretraining image backbones with deep generative models,
2023.