Skip to main content

A package for generalized image classification using In-Context-Learning with PyTorch.

Project description

PictSure: In-Context Learning for Image Classification

PyPI Downloads arXiv

PictSure is a deep learning library designed for in-context learning using images and labels. It allows users to provide a set of labeled reference images and then predict labels for new images based on those references. This approach eliminates the need for traditional training, making it highly adaptable for various classification tasks.

The classification process

Features

  • In-Context Learning: Predict labels for new images using a set of reference images without traditional model training.
  • Multiple Model Architectures: Choose between ResNet and ViT-based models for your specific needs.
  • Pretrained Models: Use our pretrained models or train your own.
  • Torch Compatibility: Fully integrated with PyTorch, supporting CPU and GPU.
  • Easy-to-use CLI: Manage models and weights through a simple command-line interface.

Installation

pip install PictSure

Quick Start

from PictSure import PictSure
import torch

DEVICE = "cpu" # or cuda, mps

model = PictSure.from_pretrained("pictsure/pictsure-vit")
model = model.to(DEVICE)

# Set your reference images and labels
model.set_context_images(reference_images, reference_labels)

# Make predictions on new images
predictions = model.predict(new_images)

Examples

For a complete working example, check out the Jupyter notebook in the Examples directory:

Examples/example.ipynb

This notebook demonstrates:

  • Model initialization
  • Loading and preprocessing images
  • Setting up reference images
  • Making predictions
  • Visualizing results

Citation

If you use this work, please cite it using the following BibTeX entry:

@article{schiesser2025pictsure,
  title={PictSure: Pretraining Embeddings Matters for In-Context Learning Image Classifiers},
  author={Schiesser, Lukas and Wolff, Cornelius and Haas, Sophie and Pukrop, Simon},
  journal={arXiv preprint arXiv:2506.14842},
  year={2025}
}

License

This project is open-source under the MIT License.

Contributing

Contributions and suggestions are welcome! Open an issue or submit a pull request.

Contact

For questions or support, open an issue on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pictsure-0.2.2.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pictsure-0.2.2-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file pictsure-0.2.2.tar.gz.

File metadata

  • Download URL: pictsure-0.2.2.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pictsure-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b69be000a8c1b8542e6e7dcfdd7d63ff8e40e53629673641d46a89e6e9028d6e
MD5 3c5c8c5a93aad53a2c16fb1677af1077
BLAKE2b-256 df5348ffefde0abbde0c7ac8b4857ad0b035404352517a04d25cb1c2d711d8a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pictsure-0.2.2.tar.gz:

Publisher: publish.yml on PictSure/pictsure-library

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pictsure-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: pictsure-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pictsure-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 93afdf337006a5a96fdd69a0b03090aae906542111c267fe9633d713d9924966
MD5 ee7ae3932c96ec41f0e366345f21c839
BLAKE2b-256 07053e43421d2a23f3306991b808289efbc7b1a9db3e08860108a2ffe34b1edd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pictsure-0.2.2-py3-none-any.whl:

Publisher: publish.yml on PictSure/pictsure-library

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page