FiCo-ITR: Fine-grained and Coarse-grained Image-Text Retrieval
A unified evaluation library for image-text retrieval research
Overview
FiCo-ITR provides a standardized evaluation framework for image-text retrieval models, supporting both instance-level (fine-grained) and category-level (coarse-grained) retrieval evaluation. The library handles diverse data formats encountered in current research, making it easy to evaluate and compare different models.
✨ Features
- Universal Format Support - Automatically handles various embedding and matrix formats and orientations
- Flexible Distributions - Supports both uniform and non-uniform caption distributions
- Dual Evaluation - Instance-level and category-level retrieval tasks and metrics
- Zero Configuration - Works out-of-the-box for most models
- Extensible - Easy to adapt for custom evaluation needs
📦 Installation
pip install fico_itr
🚀 Quick Start
from fico_itr import instance_retrieval, category_retrieval
# Compute Similarity Matrix
similarity_matrix = compute_similarity(image_embeddings, text_embeddings, measure='cosine')
# Instance-level retrieval - just pass your similarity matrix
i2t_instance_results, t2i_instance_results = instance_retrieval(similarity_matrix)
# Category-level retrieval - add labels for mAP evaluation
i2t_category_results, t2i_category_results = category_retrieval(similarity_matrix, labels)
print(f"Instance Retrieval Results - I2T: {i2t_instance_results} T2I: {t2i_instance_results}")
print(f"Category Retrieval Results - I2T: {i2t_category_results} T2I: {t2i_category_results}")
📖 Usage Guide
1. Standard Case (Uniform Images x Captions Matrix)
# Just pass your similarity matrix
results = instance_retrieval(similarity_matrix)
2. Non-uniform Caption Distribution
For datasets where images have varying numbers of captions (e.g., COCO with 25010 captions):
# Option A: Load pre-computed mapping (for COCO)
caption_mapping = np.load('mscoco_test_indices.npy')
# Option B: Create your own mapping
caption_mapping = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, ...] # Which image each caption belongs to
results = instance_retrieval(similarity_matrix, captions_per_image=caption_mapping)
3. Square Matrices (Duplicated Images)
Some models duplicate images to create square matrices:
# E.g., vsrn/ucch with 5000×5000 matrix (1000 images duplicated 5×)
results = instance_retrieval(similarity_matrix, captions_per_image=5)
4. Separate Directional Matrices
For models with different similarity matrices per direction:
# E.g., BLIP2, XVLM with task-specific fine-tuning
results = instance_retrieval(
i2t_similarity_matrix,
t2i_sim=t2i_similarity_matrix,
captions_per_image=5 # or caption_mapping for non-uniform
)
📊 Model Examples
| Model | Dataset | Special Handling | Parameter |
|---|---|---|---|
| SCAN, IMRAM | Any | None | - |
| BEiT-3 | Flickr30k | None | - |
| BEiT-3 | COCO | Non-uniform | caption_mapping |
| VSRN, UCCH | Any | Square matrix | captions_per_image=5 |
| BLIP-2, X-VLM | Any | Separate matrices | t2i_sim=... |
| DADH | Any | Auto-transposed | - |
📚 Documentation
- Technical Documentation - Implementation details
- Alignment - How data alignment works
- Similarity - Available similarity measures
- Tasks - Evaluation metrics and algorithms
- Paper Tutorial - Reproduce paper results with pre-computed embeddings
📋 Requirements
- Python 3.7+
- numpy
📄 Citation
If you use FiCo-ITR in your research, please cite:
@article{williams-lekuona2025ficoitr,
author = {Mikel Williams-Lekuona and Georgina Cosma},
title = {FiCo-ITR: Bridging Fine-Grained and Coarse-Grained Image-Text Retrieval for Comparative Performance Analysis},
journal = {International Journal of Multimedia Information Retrieval},
volume = {14},
number = {2},
pages = {20},
year = {2025},
publisher={Springer}
}
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
This project includes code generated with the assistance of AI coding tools.
Metadata
Release files for fico-itr 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fico_itr-1.0.0.tar.gz | 13.5 kB | Without provenance | Details for fico_itr-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fico_itr-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for fico_itr-1.0.0-py3-none-any.whl |
Total release size: 23.8 kB
Release files / fico_itr-1.0.0.tar.gz
| Download URL | fico_itr-1.0.0.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
603fa26cfa445c83553bb49b0377fee84625a9f31133b3e95b1929de5f37cde0
|
|
BLAKE2b-256 checksum How to use checksums |
7b6fbd83f35d1009f923a505b086996af1b21b169b7113fdb68ddb96bb89e63b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.3
|
Release files / fico_itr-1.0.0-py3-none-any.whl
| Download URL | fico_itr-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c0998aae2055bacd427dc34006acadb6ef7d18931fcb05ccc1fcf940b0ca0fe
|
|
BLAKE2b-256 checksum How to use checksums |
6b72e917e17ef6877945743199b5af0f339d1ddd813d5c587ce26981fb0893e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.3
|
Security for fico-itr 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.