PictSure
(link to project website) is a novel few-shot learning model for image classification that leverages context images to make predictions on new, unseen images. The model combines pre-trained image encoders with transformer architecture to enable effective few-shot learning with minimal examples. More details can be found on
our paper page.
1pip install torch torchvision
2pip install huggingface_hub
3pip install PictSure
This example can also be found (including the mentioned images) in
our GitHub Repository.
1from PictSure import PictSure
2from PIL import Image
3
4# Load pre-trained model
5model = PictSure.from_pretrained("pictsure/pictsure-vit")
6
7# Prepare context images and labels
8context_images = [
9 Image.open("cat1.jpg"),
10 Image.open("cat2.jpg"),
11 Image.open("dog1.jpg"),
12 Image.open("dog2.jpg")
13]
14context_labels = [0, 0, 1, 1] # 0 for cat, 1 for dog
15
16# Set context
17model.set_context_images(context_images, context_labels)
18
19# Make prediction on new image
20test_image = Image.open("unknown_animal.jpg")
21prediction = model.predict(test_image)
22print(f"Predicted class: {prediction}")
The pre-trained models were trained on curated datasets for few-shot learning evaluation:
1@misc{schiesser2025pictsure,
2 title={PictSure: Pretraining Embeddings Matters for In-Context Learning Image Classifiers},
3 author={Lukas Schiesser and Cornelius Wolff and Sophie Haas and Simon Pukrop},
4 year={2025},
5 eprint={2506.14842},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2506.14842},
9}
For questions about this model card or the PictSure model, open an issue in the
GitHub repository.