File size: 626 Bytes
625a17f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import json
from pycocotools.coco import COCO
from tqdm import tqdm
import string



text_pth  = "/data/work-gcp-europe-west4-a/yuqian_fu/datasets/HANDAL/test_json/handal_dataset_mugs_test.json"
save_path = "/data/work-gcp-europe-west4-a/yuqian_fu/datasets/HANDAL/test_json/handal_dataset_mugs_test_videoname.json"

new_data = []

with open(text_pth, "r") as fp:
   datas = json.load(fp)



# data是一帧帧图片
for data in datas:
    video_name = data["image"].split("/")[0]
    data["video_name"] = video_name
    new_data.append(data)


print(len(new_data))
with open(save_path, "w") as fp:
    json.dump(new_data, fp)