Views
No views yet
1pip install torch torchvision
2pip install huggingface_hub
3pip install PictSure1from PictSure import PictSure
2from PIL import Image
3
4# Load pre-trained model
5model = PictSure.from_pretrained("pictsure/pictsure-dinov2")
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}")| Model | Backbone | Parameters | Model Size | Performance |
|---|---|---|---|---|
| ResPreAll | ResNet18 | 53M | ~200MB | Balanced speed/accuracy |
| ViTPreAll | ViT-Base | 128M | ~500MB | Higher accuracy |
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}