| # encoding: utf-8 | |
| # a = input("please input a number:") | |
| import pdb | |
| import torch | |
| import json | |
| import pdb | |
| vigil = json.load(open('/mnt/petrelfs/wangzehan/LLaVA-Next-3D/data/processed/intent3d_id_v3_val_llava_style.json', 'r')) | |
| # vigil = json.load(open('/mnt/petrelfs/wangzehan/LLaVA-Next-3D/data/processed/vigil3d_scannet_id_v2_val_llava.json', 'r')) | |
| scanrefer = json.load(open('/mnt/petrelfs/wangzehan/LLaVA-Next-3D/data/processed/scanrefer_vg_val_llava_style.json', 'r')) | |
| box_info = json.load(open('/mnt/petrelfs/wangzehan/LLaVA-Next-3D/data/metadata/scannet_val_gt_box.json', 'r')) | |
| num_id = 0 | |
| vigil_val = [] | |
| for vigil_item in vigil: | |
| obj_ids = vigil_item['metadata']['object_id'] | |
| if len(obj_ids) == 0: | |
| box = [] | |
| else: | |
| box = [box_info[vigil_item['video']][int(obj_id)] for obj_id in obj_ids] | |
| desc = vigil_item['conversations'][0]['value'].split('\n')[1] | |
| new_item = {"id": num_id, "video": vigil_item['video'], "conversations": [ | |
| {"value": f"<image>Identify the object according to the following description.\n{desc}", "from": "human"}, | |
| {"value": "<ground>", "from": "gpt"}], | |
| "box": box, | |
| "metadata": {"dataset": "vigil", "question_type": "multiple", "ann_id": num_id, "object_id": obj_ids}} | |
| vigil_val.append(new_item) | |
| num_id += 1 | |
| with open('/mnt/petrelfs/wangzehan/LLaVA-Next-3D/extra_data/Other_VG/intent3d_full_vg_val_llava_style.json', 'w') as f: | |
| json.dump(vigil_val, f, indent=4) | |