๐ Setup
July 2, 2025 ยท View on GitHub
๐ ImageScope ๐
Unifying Language-Guided Image Retrieval via Large Multimodal Model Collective Reasoning
Pengfei Luoโ , Jingbo Zhouโก, Tong Xuโ , Yuan Xiaโก, Linli Xuโ , Enhong Chenโ
โ University of Science and Technology of China
โก Baidu Inc

๐ Setup
Environment
Create virtual environment:
conda create -n ImageScope python=3.10.14
conda activate ImageScope
Install Pytorch
pip install torch==2.4.0 torchvision==0.19.0 --index-url https://download.pytorch.org/whl/cu118
Install other libraries:
pip install xformers==0.0.27.post2 --index-url https://download.pytorch.org/whl/cu118
pip install https://github.com/vllm-project/vllm/releases/download/v0.5.4/vllm-0.5.4+cu118-cp310-cp310-manylinux1_x86_64.whl
pip install -r requirements.txt
Datasets
Put all dataset in a folder data as follows:
./data
โโโ CIRCO
โโโ CIRR
โโโ FashionIQ
โโโ Flickr30K
โโโ MSCOCO
โโโ VisDial
CIRCO
Please follow the instruction of the CIRCO official repository
miccunifi/CIRCO to prepare the dataset.
Move the folder unlabeled2017 and the folder CIRCO structure should look like:
./CIRCO
โโโ captions
โ โโโ val.json
โ โโโ test.json
โโโ unlabeled2017
โโโ 000000572834.jpg
โโโ 000000088597.jpg
โโโ 000000386336.jpg
โโโ ...
CIRR
Please follow the instruction of the CIRR official repository
Cuberick-Orion/CIRR to prepare the dataset.
Make the folder CIRR structure looks as follows:
./CIRR
โโโ LICENSE
โโโ README.md
โโโ captions_ext
โ โโโ cap.ext.rc2.test1.json
โ โโโ cap.ext.rc2.train.json
โ โโโ cap.ext.rc2.val.json
โโโ image_splits
โ โโโ split.rc2.val.json
โ โโโ split.rc2.train.json
โ โโโ split.rc2.test1.json
โโโ dev
โ โโโ dev-841-3-img0.png
โ โโโ dev-30-2-img1.png
โ โโโ dev-954-2-img1.png
โ โโโ ...
โโโ captions
โ โโโ cap.rc2.train.json
โ โโโ ._cap.rc2.val.json
โ โโโ cap.rc2.val.json
โ โโโ ...
โโโ test1
โโโ test1-1005-3-img0.png
โโโ test1-400-0-img1.png
โโโ test1-718-0-img0.png
โโโ ...
FashionIQ
Download and extract files form ๐คHuggingFace - Plachta/FashionIQ, and organize the folder FashionIQ like:
./FashionIQ
โโโ image_splits
โ โโโ split.dress.val.json
โ โโโ split.toptee.val.json
โ โโโ split.dress.train.json
โ โโโ ...
โโโ captions
โ โโโ cap.shirt.test.json
โ โโโ cap.shirt.val.json
โ โโโ cap.toptee.test.json
โ โโโ ...
โโโ images
โโโ B0088D23WY.png
โโโ B000QB12QY.png
โโโ B001I90CD2.png
โโโ ...
Flickr30K
Download and extract files form ๐คHuggingFace - nlphuji/flickr_1k_test_image_text_retrieval, and organize the folder Flickr30K like:
./Flickr30K
โโโ README.md
โโโ test_1k_flickr.csv
โโโ images_flickr_1k_test.zip
โโโ test_1k_flickr.csv
โโโ images
โโโ 2847514745.jpg
โโโ 4689169924.jpg
โโโ 2088705195.jpg
โโโ ..
MSCOCO
Download and extract files form ๐คHuggingFace - nlphuji/mscoco_2014_5k_test_image_text_retrieval, and organize the folder MSCOCO like:
./MSCOCO
โโโ README.md
โโโ test_5k_mscoco_2014.csv
โโโ mscoco_2014_5k_test_image_text_retrieval.py
โโโ images_mscoco_2014_5k_test.zip
โโโ .gitattributes
โโโ images
โโโ COCO_val2014_000000466052.jpg
โโโ COCO_val2014_000000335631.jpg
โโโ COCO_val2014_000000297972.jpg
โโโ ...
VisDial
Obtain Protocal/Search_Space_val_50k.json and dialogues/VisDial_v1.0_queries_val.json from the
Saehyung-Lee/PlugIR repository. Download the images COCO 2017 Unlabeled Images. Place the downloaded files in the folder VisDial and organize it as follows:
./VisDial
โโโ Search_Space_val_50k.json
โโโ VisDial_v1.0_queries_val.json
โโโ unlabeled2017
โโโ 000000572834.jpg
โโโ 000000088597.jpg
โโโ 000000386336.jpg
โโโ ...
Once you have completed these steps, your dataset is ready for use.
Models
Download the pre-trained model weights from the links provided below.
| Role | Model | Link |
|---|---|---|
| Captioner | LLaVA-v1.6-vicuna-7B | ๐คllava-hf/llava-v1.6-vicuna-7b-hf |
| Reasoner | LLaMA3-8B-Instruct | ๐คmeta-llama/Meta-Llama-3-8B-Instruct |
| Verifier | PaliGemma-3B-mix-224 | ๐คgoogle/paligemma-3b-mix-224 |
| Evaluator | InternVL2-8B | ๐คOpenGVLab/InternVL2-8B |
| VLM | CLIP-ViT-B-32-laion2B-s34B-b79K CLIP-ViT-L-14-laion2B-s32B-b82K | ๐คlaion/CLIP-ViT-B-32-laion2B-s34B-b79K ๐คlaion/CLIP-ViT-L-14-laion2B-s32B-b82K |
You can place the downloaded weights in a directory of your choice, and specify the path to the models in the configuration or script when running the pipeline.
๐ Inference and Evaluation
Inference
To run inference on a specific dataset, modify the model path in the corresponding script located in the script/run_{dataset_name}.sh folder. Replace the placeholder with your actual model path. Once updated, execute the script using the command bash script/run_{dataset_name}.sh to initiate the inference process.
By default, the script utilizes all available GPUs. If you wish to restrict GPU usage, manually configure the CUDA_VISIBLE_DEVICES environment variable. On the first run, the pipeline will automatically create an image_db directory to store image captions and embeddings for retrieval purposes.
Note: For the CIRR subset setting, you need to include the --subset flag in the command within the script.
Evaluation
After completing the inference, evaluation metrics (for FashionIQ, Flickr30K, MSCOCO, and VisDial) or submission files (for CIRCO and CIRR) can be found in the runs folder. Metrics are logged in files located at runs/{dataset_name}/{runs_name}/{clip_version}-{timestamp}/output.log, while prediction results are saved as JSON files at runs/{dataset_name}/{runs_name}/{clip_version}-{timestamp}/{timestamp}_{dataset_name}_test_stage3_eval.json. You can submit these JSON files to the CIRR Evaluation Server or CIRCO Evaluation Server to obtain the final evaluation results.
Experimental Results


๐ Citation
If you find our paper and code are useful in your research, please cite it as follows:
@inproceedings{luo2025imagescope,
title={ImageScope: Unifying Language-Guided Image Retrieval via Large Multimodal Model Collective Reasoning},
author={Luo, Pengfei and Zhou, Jingbo and Xu, Tong and Xia, Yuan and Xu, Linli and Chen, Enhong},
booktitle={The Web Conference 2025},
year={2025}
}