Zero-Shot Image Classification
Transformers
Safetensors
siglip
vision

The output is very small

#18
by weathon - opened

example code:

from transformers import pipeline

# load pipeline
ckpt = "google/siglip2-base-patch16-224"
image_classifier = pipeline(model=ckpt, task="zero-shot-image-classification")

# load image and candidate labels
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
candidate_labels = ["2 cats", "a plane", "a remote"]

# run inference
outputs = image_classifier(image, candidate_labels)
print(outputs)

Output: [{'score': 0.00018089247168973088, 'label': 'a remote'}, {'score': 1.4832610759185627e-05, 'label': 'a plane'}, {'score': 1.9581771084631328e-06, 'label': '2 cats'}]

Sign up or log in to comment