Repoaner commited on
Commit
e9ed9dc
·
verified ·
1 Parent(s): 458a86b

Upload LLaVA-Next-3D/data_precessing/intent3d.py with huggingface_hub

Browse files
LLaVA-Next-3D/data_precessing/intent3d.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # encoding: utf-8
2
+ # a = input("please input a number:")
3
+ import pdb
4
+ import torch
5
+ import json
6
+ import pdb
7
+
8
+ vigil = json.load(open('/mnt/petrelfs/wangzehan/LLaVA-Next-3D/data/processed/intent3d_id_v3_val_llava_style.json', 'r'))
9
+ # vigil = json.load(open('/mnt/petrelfs/wangzehan/LLaVA-Next-3D/data/processed/vigil3d_scannet_id_v2_val_llava.json', 'r'))
10
+ scanrefer = json.load(open('/mnt/petrelfs/wangzehan/LLaVA-Next-3D/data/processed/scanrefer_vg_val_llava_style.json', 'r'))
11
+ box_info = json.load(open('/mnt/petrelfs/wangzehan/LLaVA-Next-3D/data/metadata/scannet_val_gt_box.json', 'r'))
12
+
13
+ num_id = 0
14
+ vigil_val = []
15
+ for vigil_item in vigil:
16
+
17
+ obj_ids = vigil_item['metadata']['object_id']
18
+ if len(obj_ids) == 0:
19
+ box = []
20
+ else:
21
+ box = [box_info[vigil_item['video']][int(obj_id)] for obj_id in obj_ids]
22
+
23
+ desc = vigil_item['conversations'][0]['value'].split('\n')[1]
24
+
25
+ new_item = {"id": num_id, "video": vigil_item['video'], "conversations": [
26
+ {"value": f"<image>Identify the object according to the following description.\n{desc}", "from": "human"},
27
+ {"value": "<ground>", "from": "gpt"}],
28
+ "box": box,
29
+ "metadata": {"dataset": "vigil", "question_type": "multiple", "ann_id": num_id, "object_id": obj_ids}}
30
+
31
+ vigil_val.append(new_item)
32
+ num_id += 1
33
+
34
+ with open('/mnt/petrelfs/wangzehan/LLaVA-Next-3D/extra_data/Other_VG/intent3d_full_vg_val_llava_style.json', 'w') as f:
35
+ json.dump(vigil_val, f, indent=4)
36
+