Metadata-Version: 2.4
Name: PictSure
Version: 0.1.1
Summary: A package for generalized image classification using In-Context-Learning with PyTorch.
Author-email: Cornelius Wolff <cornelius.wolff@cwi.nl>, Lukas Schiesser <lukas.schiesser@dfki.de>
License: MIT License
        
        Copyright (c) 2025 Cornelius Wolff; Lukas Schiesser
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=2.7.0
Requires-Dist: torchvision>=0.22.0
Requires-Dist: numpy>=1.26.4
Requires-Dist: Pillow
Requires-Dist: click>=8.1.7
Requires-Dist: tqdm>=4.66.4
Requires-Dist: requests>=2.32.3
Requires-Dist: huggingface-hub>=0.33.1
Requires-Dist: safetensors>=0.5.3
Dynamic: license-file

# PictSure: In-Context Learning for Image Classification

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.

<p align="center">
  <img src="images/Flow-Chart.png" alt="The classification process" width="90%" />
</p>

## 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
```bash
pip install PictSure
```

## Quick Start
```python
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:
```bash
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:

```bibtex
@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.

