Your Diffusion Model is Secretly a Zero-Shot Classifier

Alexander C. Li, Mihir Prabhudesai, Shivam Duggal, Ellis Brown, Deepak Pathak
3/28/2023
cs.LGcs.AIcs.CV

No official code found. Best implementation: diffusion-classifier/diffusion-classifier (496 stars, last commit 2024-02-28). 1 more below.

Abstract

The recent wave of large-scale text-to-image diffusion models has dramatically increased our text-based image generation abilities. These models can generate realistic images for a staggering variety of prompts and exhibit impressive compositional generalization abilities. Almost all use cases thus far have solely focused on sampling; however, diffusion models can also provide conditional density estimates, which are useful for tasks beyond image generation. In this paper, we show that the density estimates from large-scale text-to-image diffusion models like Stable Diffusion can be leveraged to perform zero-shot classification without any additional training. Our generative approach to classification, which we call Diffusion Classifier, attains strong results on a variety of benchmarks and outperforms alternative methods of extracting knowledge from diffusion models. Although a gap remains between generative and discriminative approaches on zero-shot recognition tasks, our diffusion-based approach has significantly stronger multimodal compositional reasoning ability than competing discriminative approaches. Finally, we use Diffusion Classifier to extract standard classifiers from class-conditional diffusion models trained on ImageNet. Our models achieve strong classification performance using only weak augmentations and exhibit qualitatively better "effective robustness" to distribution shift. Overall, our results are a step toward using generative over discriminative models for downstream tasks. Results and visualizations at https://diffusion-classifier.github.io/

View on arXivView PDF

Code Implementations(2)

Diffusion Classifier leverages pretrained diffusion models to perform zero-shot classification without additional training

49645PythonMar 28, 20232 years ago
bayes-theoremclassificationcomputer-visiondeep-learningdiffusion+10 more

Source code for the "Your Diffusion Model is Secretly a Zero-Shot Classifier" project webpage.

30CSS, HTMLMar 28, 20232 years ago

Similar Papers

Cite this paper

@article{li2023your,
  title  = {Your Diffusion Model is Secretly a Zero-Shot Classifier},
  author = {Alexander C. Li and Mihir Prabhudesai and Shivam Duggal and Ellis Brown and Deepak Pathak},
  year   = {2023},
  eprint = {2303.16203},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2303.16203v3},
  journal = {ICCV 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2303.16203.svg)](https://codeofpaper.com/paper/2303.16203)

Discussion