Installation | Initializing Scendi Score | Computing Scendi Score | Clustering with Scendi | Datasets used | Citation |
A GitHub repository accompanying a "Scendi Score: Prompt-Aware Diversity Evaluation via Schur Complement of CLIP Embeddings" paper
- Clone the repository
git clone https://github.com/aziksh-ospanov/scendi-score.git
cd scendi-score
- Install dependencies
pip install -r requirements.txt
To compute Scendi score presented in the paper, initialize Scendi with the following:
from scendi.score import ScendiEvaluator
from scendi.datasets.ImageFilesDataset import ImageFilesDataset
#%%
sigma = 3.5 # Gaussian kernel bandwidth parameter
fe = 'clip' # Embedding that supports both text and image modalities
result_name = 'your_result_name'
img_pth = 'path_to_images'
text_pth = 'path_to_text.txt'
with open(text_pth, 'r') as f:
prompts = f.readlines()
image_dataset = ImageFilesDataset(img_pth, name=result_name, extension='png')
scendi = ScendiEvaluator(logger_path='./logs', batchsize=64, sigma=sigma, num_samples=num_samples, result_name=result_name, rff_dim=2500, save_visuals_path=f'visuals_{result_name}')
scendi.set_schur_feature_extractor(fe, save_path='./save')
In this snippet, parameter sigma controls the bandwidth of the Gaussian Kernel and fe allows to choose a specific feature extractor. In this repository we provide an implementation for CLIP, but other feature extractors may be used. We note that to access T2I and I2T evaluations, the feature extractor should support encoding of both text and image domains.
To calculate the Scendi Score for a paired text-image dataset, use the following function:
# Get Scendi Scores
score = scendi.scendi_score(prompts, image_dataset)
The script enables clustering of images after applying Scendi CLIP embedding correction based on prompts. Use the following function:
# Cluster Results
scendi.scendi_clustering_of_dataset(prompts, image_dataset)
Note that top images, number of modes and sensitivity (sigma parameter) are adjustable. The results are stored in location specified in save_visuals_path.
We provide access to datasets as follows:
@inproceedings{
ospanov2025scendi,
title = {Scendi Score: Prompt-Aware Diversity Evaluation via Schur Complement of CLIP Embeddings},
author = {Azim Ospanov and Mohammad Jalali and Farzan Farnia},
booktitle = {International Conference on Computer Vision},
year = {2025}
}
This README.md
file provides a clear and concise guide for users to understand and run the demo script, including installation instructions, usage examples, and parameter explanations. Adjust the paths and filenames in the script to match your specific environment and dataset.