forked from isaac-sim/OmniIsaacGymEnvs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload.py
More file actions
52 lines (46 loc) · 1.76 KB
/
load.py
File metadata and controls
52 lines (46 loc) · 1.76 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
import json
def load_annotation_file():
folder = '/home/nikepupu/Desktop/gapartnet_new_subdivition/partnet_all_annotated_new/annotation'
subfolders = os.listdir(folder)
subfolders.sort()
# filter out files starts with 4 and has 5 digits
subfolders = [f for f in subfolders if f.startswith('4') and len(f) == 5]
annotation_json = 'link_anno_gapartnet.json'
annotation = {}
for subfolder in subfolders:
annotation_path = os.path.join(folder, subfolder, annotation_json)
with open(annotation_path, 'r') as f:
annotation[subfolder] = json.load(f)
return annotation
def load_usd_paths():
folder = '/home/nikepupu/Desktop/Orbit/NewUSD'
subfolders = os.listdir(folder)
subfolders = [f for f in subfolders if f.startswith('4') and len(f) == 5]
usds = [os.path.join(folder, f, 'mobility_relabel_gapartnet.usd') for f in subfolders]
return usds
# usds = load_usd_paths()
# print(usds)
annotation = load_annotation_file()
tmp = annotation['40147']
print(tmp)
print()
# for item in tmp:
# print(item['category'])
# print(item['link_name'])
# print('\n')
def load_joint_file():
folder = '/home/nikepupu/Desktop/gapartnet_new_subdivition/partnet_all_annotated_new/annotation'
subfolders = os.listdir(folder)
subfolders.sort()
# filter out files starts with 4 and has 5 digits
subfolders = [f for f in subfolders if f.startswith('4') and len(f) == 5]
annotation_json = 'mobility_v2.json'
annotation = {}
for subfolder in subfolders:
annotation_path = os.path.join(folder, subfolder, annotation_json)
with open(annotation_path, 'r') as f:
annotation[int(subfolder)] = json.load(f)
return annotation
anno = load_joint_file()
print(anno[40147])