Datasets:
File size: 2,848 Bytes
1dda194 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # MIPR evaluation
Encode queries and products, retrieve and rerank candidates, and evaluate saved rankings.
| File | Function |
|---|---|
| `embedding.py` | Encode query image + question and product image + title with Qwen3-VL-Embedding |
| `retrieval.py` | Cosine top-k retrieval over the released product corpus |
| `reranker.py` | Six model adapters, pair scoring and ranking output |
| `evaluate.py` | Main metrics, candidate-pool checks and Oracle |
| `analysis.py` | L1/L2 preference, hard-negative metrics and solution-category grouping |
## Usage
Run from the release root. Data defaults to `data/`; use `--data DIR` to override it.
```bash
# Evaluate saved rankings; no model inference needed.
python evaluation/evaluate.py data/baseline/qwen3_vl_embedding_8b_top50.json
python evaluation/evaluate.py data/baseline/qwen3_vl_reranker_8b_top50.json --rerank
python evaluation/analysis.py data/baseline/qwen3_vl_embedding_8b_top50.json
# Encode and retrieve.
python evaluation/embedding.py --out runs/embedding
python evaluation/retrieval.py --embed-dir runs/embedding --output runs/retrieval.json
# Score and reorder the baseline's top-50 candidates.
python evaluation/reranker.py --model qwen3_vl_reranker_8b --output runs/rerank.json
python evaluation/evaluate.py runs/rerank.json --rerank
```
The encoder writes `query_ids.json`, `query_embeds.npy`, `candidate_ids.json` and `candidate_embeds.npy`. Other embedding models can supply the same files. Candidate vectors must cover the released corpus.
Reranker tags: `qwen3_vl_reranker_8b`, `qwen3_vl_8b_instruct`, `qwen2_vl_7b_instruct`, `lychee_rerank_mm`, `internvl3_5_8b`, `llava_1_5_7b`. The last two are supplemental adapters. Use `--model-path DIR` for local weights and `--baseline FILE` for another top-50 candidate pool. Scoring writes the final ranking when complete.
## Metrics
- nDCG@10/20/50 uses gains L1=2, L2=1, all others=0, including unjudged pairs.
- R-L1@10/20/50 is macro recall over judged L1 products; Hit-L1@1/10 measures whether a prefix contains any L1.
- SC-R-L1@10 measures coverage of judged L1 leaf categories by retrieved L1 products. Metrics suffixed `_mc` use queries with at least two L1 categories.
- Oracle reorders the fixed candidate pool: L1 products round-robin across categories, then L2, then the rest.
- Analysis reports R-(L1+L2)@50, HeadInv-L2/N1/N2@50 and Hit-N1/N2@10, with each metric's eligible-query count. It also reports nDCG@10 and SC-R-L1@10 grouped by L1 category count (1–7, 8+).
Values are percentages; an empty eligible subset yields `nan`. Evaluation requires all benchmark queries, unique known product IDs, and an unchanged candidate pool for reranking.
Metric scripts use the Python standard library. Retrieval requires NumPy; model inference requires the packages in `requirements.txt`, and reranking uses CUDA.
|