File size: 380 Bytes
bd4d522
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import json

with open("/mnt/petrelfs/zhuchenglin/clipscore/coco_gen_200k copy.json", "r") as f:
    data = json.load(f)

# Convert the data to a list of dictionaries
data = [{"id": key, "clipscore": value["CLIPScore"]} for key, value in data.items()]

# Save the modified data
with open("/mnt/petrelfs/zhuchenglin/clipscore/coco_gen_200k.json", "w") as f:
    json.dump(data, f)