10
10
from oxford_spires_utils .trajectory .json_handler import JsonHandler
11
11
12
12
13
- def convert_to_tum (path_to_output , path_to_sec ):
14
-
13
+ def convert_to_tum (path_to_output , path_to_sec ):
15
14
print ("Convert from JSON format to TUM!!" )
16
15
17
16
# Remove other cameras
@@ -28,80 +27,81 @@ def convert_to_tum (path_to_output, path_to_sec):
28
27
print ("*********************************************************" )
29
28
30
29
31
- def get_sec_list (dataset_dir , flag_is_all = True ):
30
+ def get_sec_list (dataset_dir , flag_is_all = True ):
32
31
if flag_is_all :
33
32
list_sec = os .listdir (dataset_dir )
34
33
else :
35
34
list_sec = [
36
- "2024-03-12-keble-college-02" ,
37
- "2024-03-12-keble-college-03" ,
38
- "2024-03-12-keble-college-04" ,
39
- "2024-03-12-keble-college-05" ,
40
- "2024-03-13-observatory-quarter-01" ,
41
- "2024-03-13-observatory-quarter-02" ,
42
- "2024-03-14-blenheim-palace-01" ,
43
- "2024-03-14-blenheim-palace-02" ,
44
- "2024-03-14-blenheim-palace-05" ,
45
- "2024-03-18-christ-church-01" ,
46
- "2024-03-18-christ-church-02" ,
47
- "2024-03-18-christ-church-03" ,
48
- "2024-03-20-christ-church-05" ,
49
- "2024-05-20-bodleian-library-02" ,
50
- "2024-05-20-bodleian-library-03" ,
51
- "2024-05-20-bodleian-library-04" ,
52
- "2024-05-20-bodleian-library-05"
53
- ]
35
+ "2024-03-12-keble-college-02" ,
36
+ "2024-03-12-keble-college-03" ,
37
+ "2024-03-12-keble-college-04" ,
38
+ "2024-03-12-keble-college-05" ,
39
+ "2024-03-13-observatory-quarter-01" ,
40
+ "2024-03-13-observatory-quarter-02" ,
41
+ "2024-03-14-blenheim-palace-01" ,
42
+ "2024-03-14-blenheim-palace-02" ,
43
+ "2024-03-14-blenheim-palace-05" ,
44
+ "2024-03-18-christ-church-01" ,
45
+ "2024-03-18-christ-church-02" ,
46
+ "2024-03-18-christ-church-03" ,
47
+ "2024-03-20-christ-church-05" ,
48
+ "2024-05-20-bodleian-library-02" ,
49
+ "2024-05-20-bodleian-library-03" ,
50
+ "2024-05-20-bodleian-library-04" ,
51
+ "2024-05-20-bodleian-library-05" ,
52
+ ]
54
53
return list_sec
55
54
56
- def evaluation_ape_rmse ( path_to_gt , path_traj , dataset_dir , method ):
57
-
55
+
56
+ def evaluation_ape_rmse ( path_to_gt , path_traj , dataset_dir , method ):
58
57
print ("RUNNING VILENS EVALUATION ..." )
59
58
60
- output = run_command ("evo_ape tum {} {} --align --t_max_diff 0.01" .format (path_to_gt , path_traj ), print_output = False )
61
-
59
+ output = run_command (
60
+ "evo_ape tum {} {} --align --t_max_diff 0.01" .format (path_to_gt , path_traj ), print_output = False
61
+ )
62
+
62
63
rmse = - 1
63
64
for line in output .stdout :
64
65
print (line , end = "" )
65
66
if "rmse" in line :
66
- numbers = re .findall (' \d+\.\d+|\d+' , line )
67
+ numbers = re .findall (" \d+\.\d+|\d+" , line )
67
68
rmse = numbers [0 ]
68
-
69
+
69
70
logging .basicConfig (filename = dataset_dir + "results.log" , filemode = "a" , level = logging .INFO )
70
71
logging .info (path_to_sec )
71
72
logging .info ("APE - RMSE result ({}): {}" .format (method , rmse ))
72
73
print ("RMSE added to log: {}" .format (rmse ))
73
74
74
75
return rmse
75
76
76
- def create_output_folder (path_to_sec ):
77
+
78
+ def create_output_folder (path_to_sec ):
77
79
path_to_output = path_to_sec + "/output" + "/colmap/"
78
80
# if not os.path.exists(path_to_output):
79
81
# os.makedirs(path_to_output)
80
82
return path_to_output
81
83
82
- if __name__ == "__main__" :
83
84
85
+ if __name__ == "__main__" :
84
86
# -------------------------------------------------------------------------------- #
85
87
# TODO: get path from arg an define folders in the future class.
86
88
package_dir = "/home/mice85/oxford-lab/labrobotica/algorithms/oxford_spires_dataset"
87
- dataset_dir = "/media/mice85/blackdrive1/oxford_spires_dataset/data/"
89
+ dataset_dir = "/media/mice85/blackdrive1/oxford_spires_dataset/data/"
88
90
flag_is_all = False
89
91
# -------------------------------------------------------------------------------- #
90
92
91
- list_sec = get_sec_list (dataset_dir , flag_is_all )
92
-
93
- print (' Total sequence folders: ' + str (len (list_sec )))
94
-
93
+ list_sec = get_sec_list (dataset_dir , flag_is_all )
94
+
95
+ print (" Total sequence folders: " + str (len (list_sec )))
96
+
95
97
# Print list of sequences
96
98
for sec in list_sec :
97
-
98
99
path_to_sec = dataset_dir + sec
99
100
path_to_gt = path_to_sec + "/processed/trajectory/gt-tum.txt"
100
101
101
- path_to_output = create_output_folder (path_to_sec )
102
+ path_to_output = create_output_folder (path_to_sec )
102
103
103
- convert_to_tum (path_to_output , path_to_sec )
104
+ convert_to_tum (path_to_output , path_to_sec )
104
105
105
106
path_traj = path_to_sec + "/output" + "/colmap-tum.txt"
106
- rmse = evaluation_ape_rmse (path_to_gt , path_traj , dataset_dir , "COLMAP" )
107
-
107
+ rmse = evaluation_ape_rmse (path_to_gt , path_traj , dataset_dir , "COLMAP" )
0 commit comments