HubCloneHubClone
Tasks

Zero-Shot Image Classification

Zero-shot image classification labels images with classes given only as text at inference time.

Inputs

Input
A photo of a red fox in fresh snow

Zero-Shot Image Classification Model

Output

Output
  • a fox0.92
  • a dog0.06
  • a cat0.02

About Zero-Shot Image Classification

Zero-shot image classification labels images with classes given only as text at inference time. Browse zero-shot image classification models on HubClone to compare checkpoints, or open a Space to try one in the browser.

Use Cases

Open-vocabulary tagging

Tag photos with any label list.

Quick filters

Sort images without training a classifier.

Inference

The Transformers pipeline API runs zero-shot image classification models in a few lines. Replace <model-id> with any model listed on this page.

from transformers import pipeline

pipe = pipeline("zero-shot-image-classification", model="<model-id>")
pipe("fox.png")

Useful Resources

Want to dig deeper into the topic? Great! Here is a hand-picked list of resources we found helpful.

Documentation

  • Zero-Shot Image Classification task guide
  • Pipelines reference

Notebooks

  • Fine-tuning a zero-shot image classification model