Skip to content

dnth/x.retrieval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python PyPI version Downloads License

Evaluate your multimodal retrieval system with any models and datasets.

Specific inputs:

  • A dataset
  • A model
  • A mode (e.g. image-to-image)

Get evaluation metrics:

  • A retrieval results dataframe
  • A retrieval metrics dataframe

🌟 Key Features

  • ✅ Supports a wide range of models and datasets.
  • ✅ Installation in one line.
  • ✅ Run benchmarks with one function call.

🚀 Quickstart

Open In Colab Open In Kaggle

import xretrieval

metrics, results_df = xretrieval.run_benchmark(
    dataset="coco-val-2017",
    model_id="transformers/Salesforce/blip2-itm-vit-g",
    mode="text-to-text",
)
    Retrieval Metrics     
┏━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Metric        ┃ Score  ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━┩
│ MRR           │ 0.3032 │
│ NormalizedDCG │ 0.3497 │
│ Precision     │ 0.2274 │
│ Recall        │ 0.4898 │
│ HitRate       │ 0.4898 │
│ MAP           │ 0.2753 │
└───────────────┴────────┘

📦 Installation

pip install xretrieval

🛠️ Usage

List datasets:

xretrieval.list_datasets()
                    Available Datasets                     
┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Dataset Name  ┃ Description                             ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ coco-val-2017 │ The COCO Validation Set with 5k images. │
└───────────────┴─────────────────────────────────────────┘

List models:

xretrieval.list_models()
                         Available Models                         
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ Model ID                                         ┃ Model Input ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ transformers/Salesforce/blip2-itm-vit-g          │ text-image  │
│ transformers/Salesforce/blip2-itm-vit-g-text     │ text        │
│ transformers/Salesforce/blip2-itm-vit-g-image    │ image       │
│ sentence-transformers/paraphrase-MiniLM-L3-v2    │ text        │
│ sentence-transformers/paraphrase-albert-small-v2 │ text        │
│ sentence-transformers/multi-qa-distilbert-cos-v1 │ text        │
│ sentence-transformers/all-MiniLM-L12-v2          │ text        │
│ sentence-transformers/all-distilroberta-v1       │ text        │
│ sentence-transformers/multi-qa-mpnet-base-dot-v1 │ text        │
│ sentence-transformers/all-mpnet-base-v2          │ text        │
│ sentence-transformers/multi-qa-MiniLM-L6-cos-v1  │ text        │
│ sentence-transformers/all-MiniLM-L6-v2           │ text        │
│ timm/resnet18.a1_in1k                            │ image       │
└──────────────────────────────────────────────────┴─────────────┘

Visualize retrieval results:

xretrieval.visualize_retrieval(results_df)

alt text alt text

About

Evaluate your multimodal retrieval system with any models and datasets.

Resources

Stars

Watchers

Forks

Packages

No packages published