File size: 778 Bytes
94afa8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import json
import os

def hallucination_t2i_agg(model, result_dir):
    model = model.split("/")[-1]
    result_path = os.path.join(result_dir, "hallucination_t2i_summary.json")
    with open(result_path, "r") as file:
        results = json.load(file)
    agg_scores = {}
    agg_scores["score"] = results[model].pop("Average")
    agg_scores["subscenarios"] = results[model]
    return agg_scores

def hallucination_i2t_agg(model, result_dir):
    model = model.split("/")[-1]
    result_path = os.path.join(result_dir, "hallucination_i2t_summary.json")
    with open(result_path, "r") as file:
        results = json.load(file)
    agg_scores = {}
    agg_scores["score"] = results[model].pop("Average")
    agg_scores["subscenarios"] = results[model]
    return agg_scores