forked from AIS-Bonn/temporal_latticenet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfgParser.py
74 lines (58 loc) · 2.87 KB
/
cfgParser.py
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import hjson
class cfgParser():
def __init__(self, cfg_file):
with open(cfg_file, 'r') as j:
self.contents = hjson.loads(j.read())
# all getter functions return an OrderedDict
def get_core_vars(self):
return self.contents['core']
def get_train_vars(self):
return self.contents['train']
def get_eval_vars(self):
return self.contents['eval']
def get_model_vars(self):
return self.contents['model']
def get_lattice_gpu_vars(self):
return self.contents['lattice_gpu']
def get_loader_vars(self):
try:
if self.contents['train']["dataset_name"] == "semantickitti":
return self.get_loader_semantic_kitti_vars()
elif self.contents['train']["dataset_name"] == "parislille":
return self.get_loader_paris_lille_vars()
else:
print("The dataloader you requested is not found: ", self.contents['train']["dataset_name"])
return None
except:
if self.contents['eval']["dataset_name"] == "semantickitti":
return self.get_loader_semantic_kitti_vars()
elif self.contents['eval']["dataset_name"] == "parislille":
return self.get_loader_paris_lille_vars()
def get_loader_semantic_kitti_vars(self):
return self.contents['loader_semantic_kitti']
def get_loader_paris_lille_vars(self):
return self.contents['loader_paris_lille']
def get_label_mngr_vars(self):
try:
if self.contents['train']["dataset_name"] == "semantickitti":
return self.contents['loader_semantic_kitti']['label_mngr']
elif self.contents['train']["dataset_name"] == "parislille":
return self.contents['loader_paris_lille']['label_mngr']
except:
if self.contents['eval']["dataset_name"] == "semantickitti":
return self.contents['loader_semantic_kitti']['label_mngr']
elif self.contents['eval']["dataset_name"] == "parislille":
return self.contents['loader_paris_lille']['label_mngr']
def get_transformer_vars(self):
try:
if self.contents['train']["dataset_name"] == "semantickitti":
return self.contents['loader_semantic_kitti']['transformer']
elif self.contents['train']["dataset_name"] == "parislille":
return self.contents['loader_paris_lille']['transformer']
except:
if self.contents['eval']["dataset_name"] == "semantickitti":
return self.contents['loader_semantic_kitti']['transformer']
elif self.contents['eval']["dataset_name"] == "parislille":
return self.contents['loader_paris_lille']['transformer']
def get_visualization_vars(self):
return self.contents['visualization']