ezpc-embeddings / README.md
oonat's picture
Update README.md
fe6152c verified
|
Raw
History Blame Contribute Delete
8.49 kB
---
license: mit
task_categories:
- zero-shot-image-classification
- feature-extraction
language:
- en
tags:
- clip
- siglip
- embeddings
- zero-shot
- interpretability
- concept-bottleneck
- vision-language
- cvpr2026
size_categories:
- 1M<n<10M
pretty_name: EZPC Pre-computed Embeddings
---
# EZPC - Pre-computed CLIP / SigLIP Embeddings
This dataset hosts the pre-computed image embeddings, cached text (classname / concept) embeddings, and class splits used in **Explaining CLIP Zero-shot Predictions Through Concepts** (CVPR 2026).
Running EZPC from scratch requires extracting CLIP / SigLIP features for every image in five benchmark datasets (CIFAR-100, CUB-200-2011, Places365, ImageNet, ImageNet-100) with multiple backbones. To skip the expensive feature-extraction step, we release the exact tensors we used in the paper - drop them into the EZPC repo's `data/` folder and you can train, evaluate, and reproduce quantitative results without touching the raw images.
- 📄 **Paper:** [arXiv:2603.28211](https://arxiv.org/abs/2603.28211)
- 💻 **Code:** [github.com/oonat/ezpc](https://github.com/oonat/ezpc)
- 🌐 **Project page:** [oonat.github.io/ezpc](https://oonat.github.io/ezpc)
- 🤗 **Checkpoints:** [oonat/ezpc-checkpoints](https://huggingface.co/oonat/ezpc-checkpoints)
## What's Included
For each of the five datasets and each supported backbone, this repository provides:
- **Full train / test embeddings + targets:** CLIP/SigLIP image features for every training and test image across **all** classes, along with their class indices. Useful as a general-purpose feature dump and as the input to `data/split_dataset.py` if you want to regenerate the splits under a different seed or ratio.
- **Seen-split train / test embeddings:** embeddings restricted to the 80% "seen" classes. The train split is used to fit the EZPC projection matrix **A**; the test split measures GZSL seen-class accuracy.
- **Unseen-split train / test embeddings:** embeddings restricted to the 20% "unseen" classes held out from training. Used for GZSL unseen-class evaluation (and for the `--target_dataset` side of cross-dataset transfer).
- **Split-aligned target files:** `seen_train_ids.pt`, `seen_test_ids.pt`, `unseen_train_ids.pt`, `unseen_test_ids.pt`, each giving the class index for every row of the corresponding split.
- **Class split file:** the exact seen / unseen class partition (seed 42, 80/20) used in the paper.
- **Cached text embeddings:** L2-normalized `"a photo of {x}"` text embeddings for class names (`{backbone}_classname_embs.pt`, shape `(C, d)`) and concepts (`{backbone}_concept_matrix.pt`, shape `(m, d)`). `test.py` loads these automatically so evaluation reproduces the reported numbers **exactly and independent of GPU / CUDA version** — without re-running the CLIP/SigLIP text encoder.
Supported backbones: **CLIP RN50**, **CLIP ViT-B/32**, **CLIP ViT-L/14**, **SigLIP ViT-SO400M/14**.
## Repository Layout
Each dataset follows the same two-level structure: top-level `embeddings/` holds the **full** image feature dump (all classes) plus the **cached text embeddings**, and `embeddings/splits/` holds the **seen/unseen partition** used throughout the paper.
```
data/
├── CIFAR-100/
│ └── embeddings/
│ ├── RN50_train_embeddings.pt # (N_train, d) - all classes
│ ├── RN50_test_embeddings.pt # (N_test, d) - all classes
│ ├── ViT-B-32_train_embeddings.pt
│ ├── ViT-B-32_test_embeddings.pt
│ ├── ViT-L-14_train_embeddings.pt
│ ├── ViT-L-14_test_embeddings.pt
│ ├── siglip-so400m-patch14-384_train_embeddings.pt
│ ├── siglip-so400m-patch14-384_test_embeddings.pt
│ ├── RN50_classname_embs.pt # (C, d) - class-name text embeddings
│ ├── RN50_concept_matrix.pt # (m, d) - concept text embeddings
│ ├── ViT-B-32_classname_embs.pt
│ ├── ViT-B-32_concept_matrix.pt
│ ├── ViT-L-14_classname_embs.pt
│ ├── ViT-L-14_concept_matrix.pt
│ ├── siglip-so400m-patch14-384_classname_embs.pt
│ ├── siglip-so400m-patch14-384_concept_matrix.pt
│ ├── train_ids.pt # (N_train,) - class indices
│ ├── test_ids.pt # (N_test,) - class indices
│ └── splits/
│ ├── class_split.pt # {seen_classes, unseen_classes}
│ ├── RN50_seen_train_embs.pt
│ ├── RN50_seen_test_embs.pt
│ ├── RN50_unseen_train_embs.pt
│ ├── RN50_unseen_test_embs.pt
│ ├── ViT-B-32_seen_train_embs.pt
│ ├── ViT-B-32_seen_test_embs.pt
│ ├── ViT-B-32_unseen_train_embs.pt
│ ├── ViT-B-32_unseen_test_embs.pt
│ ├── ViT-L-14_seen_train_embs.pt
│ ├── ViT-L-14_seen_test_embs.pt
│ ├── ViT-L-14_unseen_train_embs.pt
│ ├── ViT-L-14_unseen_test_embs.pt
│ ├── siglip-so400m-patch14-384_seen_train_embs.pt
│ ├── siglip-so400m-patch14-384_seen_test_embs.pt
│ ├── siglip-so400m-patch14-384_unseen_train_embs.pt
│ ├── siglip-so400m-patch14-384_unseen_test_embs.pt
│ ├── seen_train_ids.pt
│ ├── seen_test_ids.pt
│ ├── unseen_train_ids.pt
│ └── unseen_test_ids.pt
├── CUB-200-2011/
│ └── embeddings/ ...
├── ImageNet/
│ └── embeddings/ ...
├── ImageNet-100/
│ └── embeddings/ ...
└── Places365/
└── embeddings/ ...
```
## Quickstart
### 1. Download the data
```bash
pip install huggingface-hub
# Grab everything
hf download oonat/ezpc-embeddings \
--repo-type dataset \
--local-dir data
# Or just one dataset
hf download oonat/ezpc-embeddings \
--repo-type dataset \
--local-dir data \
--include "CIFAR-100/*"
# Or only what EZPC needs to evaluate: the GZSL splits + cached text embeddings
hf download oonat/ezpc-embeddings \
--repo-type dataset \
--local-dir data \
--include "*/embeddings/splits/*" "*/embeddings/*_classname_embs.pt" "*/embeddings/*_concept_matrix.pt"
```
### 2. Plug it into EZPC
Clone the [EZPC GitHub repo](https://github.com/oonat/ezpc) and point `--dataset_root` at the folder you downloaded:
```bash
git clone https://github.com/oonat/ezpc.git
cd ezpc
conda env create -f environment.yml
conda activate ezpc
pip install -e .
# data/ lives next to train.py now - run training:
python train.py \
--dataset CIFAR-100 \
--dataset_root ./data \
--backbone RN50 \
--lambda_weight 1.0 \
--lr 0.01 \
--num_epochs 10000
```
## Citation
If you use this dataset, please cite:
```bibtex
@InProceedings{Ozdemir_2026_CVPR,
author = {Ozdemir, Onat and Christensen, Anders and Alaniz, Stephan and Akata, Zeynep and Akbas, Emre},
title = {Explaining CLIP Zero-shot Predictions Through Concepts},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2026},
pages = {31336-31345}
}
```
Please also cite the **original datasets** whose images were used to produce these embeddings (CIFAR-100, CUB-200-2011, Places365, ImageNet, ImageNet-100) and the backbone models (CLIP, SigLIP).
## Acknowledgements
- Concept vocabularies and class label mappings are taken from [Label-free Concept Bottleneck Models](https://github.com/Trustworthy-ML-Lab/Label-free-CBM). We thank the authors for open-sourcing them.
- Backbones from [OpenAI CLIP](https://github.com/openai/CLIP), [OpenCLIP](https://github.com/mlfoundations/open_clip), and [Google SigLIP](https://huggingface.co/google/siglip-so400m-patch14-384).
## License
Released under the MIT License.
Note that these embeddings are derived from CIFAR-100, CUB-200-2011, Places365, ImageNet, and ImageNet-100. Users are responsible for complying with the original license and terms of use of those datasets, which may restrict commercial use — notably ImageNet and CUB-200-2011, which are released for non-commercial research only.