File size: 1,368 Bytes
f17dd0c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import ir_measures
from ir_measures import *
import pandas as pd

qrels = ir_measures.read_trec_qrels('devset_qrel.csv')
vitb = ir_measures.read_trec_run('runs/ViT-B-32.laion2b_e16.t2i.trec')
vitl = ir_measures.read_trec_run('runs/ViT-L-14.laion2b_s32b_b82k.t2i.trec')
vith = ir_measures.read_trec_run('runs/ViT-H-14.laion2b_s32b_b79k.t2i.trec')
vitg = ir_measures.read_trec_run('runs/ViT-bigG-14.laion2b_s39b_b160k.t2i.trec')
splade = ir_measures.read_trec_run('runs/splade-cocondenser-ensembledistil.trec')
fusionvit = ir_measures.read_trec_run('runs/fusion_vit.trec')
fusion_all = ir_measures.read_trec_run('runs/fusion_all.trec')
fusion_vitg_splade = ir_measures.read_trec_run('runs/fusion_vitg_splade.trec')
evaluator = ir_measures.evaluator([nDCG@10, MRR(rel=3)@10, P(rel=2)@5,P(rel=3)@5, Success(rel=2)@10, Success(rel=3)@10, Rprec(rel=2)], qrels)
results = dict()
results["VIT-B"] = evaluator.calc_aggregate(vitb)
results["VIT-L"] = evaluator.calc_aggregate(vitl)
results["VIT-H"] = evaluator.calc_aggregate(vith)
results["VIT-G"] = evaluator.calc_aggregate(vitg)
results["SPLADE"] = evaluator.calc_aggregate(splade)
results["Fusion-Vit"] = evaluator.calc_aggregate(fusionvit)
results["Fusion-All"] = evaluator.calc_aggregate(fusion_all)
results["Fusion-G+SPLADE"] = evaluator.calc_aggregate(fusion_vitg_splade)
pd.DataFrame(results).T.to_excel("results.xlsx")