basalt/scripts/eval_full/gen_results.py

67 lines
1.8 KiB
Python
Raw Normal View History

2019-04-14 21:07:42 +02:00
#!/usr/bin/env python
import os
import sys
2019-07-29 16:14:02 +02:00
import json
2019-04-14 21:07:42 +02:00
2019-07-29 16:14:02 +02:00
datasets = ['Sequence', 'MH_01_easy', 'MH_02_easy', 'MH_03_medium', 'MH_04_difficult',
2019-04-14 21:07:42 +02:00
'MH_05_difficult', 'V1_01_easy', 'V1_02_medium',
'V1_03_difficult', 'V2_01_easy', 'V2_02_medium']
# Other results.
2019-07-29 16:14:02 +02:00
results_vio = ['VIO RMS ATE [m]']
time_vio = ['VIO Time [s]']
num_frames_vio = ['VIO Num. Frames']
results_mapping = ['MAP RMS ATE [m]']
time_mapping = ['MAP Time [s]']
num_frames_mapping = ['MAP Num. KFs']
2019-04-14 21:07:42 +02:00
out_dir = sys.argv[1]
2019-07-29 16:14:02 +02:00
for key in datasets[1:]:
2019-04-14 21:07:42 +02:00
fname = out_dir + '/vio_' + key
if os.path.isfile(fname):
2019-04-15 17:38:58 +02:00
with open(fname, 'r') as f:
2019-07-29 16:14:02 +02:00
j = json.load(f)
res = round(j['rms_ate'], 3)
results_vio.append(float(res))
time_vio.append(round(j['exec_time_ns']*1e-9, 3))
num_frames_vio.append(j['num_frames'])
2019-04-14 21:07:42 +02:00
else:
results_vio.append(float('Inf'))
2019-07-29 16:14:02 +02:00
time_vio.append(float('Inf'))
num_frames_vio.append(float('Inf'))
2019-04-14 21:07:42 +02:00
fname = out_dir + '/mapper_' + key
if os.path.isfile(fname):
2019-04-15 17:38:58 +02:00
with open(fname, 'r') as f:
2019-07-29 16:14:02 +02:00
j = json.load(f)
res = round(j['rms_ate'], 3)
results_mapping.append(float(res))
time_mapping.append(round(j['exec_time_ns']*1e-9, 3))
num_frames_mapping.append(j['num_frames'])
2019-04-14 21:07:42 +02:00
else:
results_mapping.append(float('Inf'))
2019-07-29 16:14:02 +02:00
time_mapping.append(float('Inf'))
num_frames_mapping.append(float('Inf'))
2019-04-14 21:07:42 +02:00
row_format ="{:>17}" * (len(datasets))
print row_format.format(*datasets)
2019-07-29 16:14:02 +02:00
2019-04-14 21:07:42 +02:00
print row_format.format(*results_vio)
2019-07-29 16:14:02 +02:00
print row_format.format(*time_vio)
print row_format.format(*num_frames_vio)
print '\n'
print row_format.format(*datasets)
2019-04-14 21:07:42 +02:00
print row_format.format(*results_mapping)
2019-07-29 16:14:02 +02:00
print row_format.format(*time_mapping)
print row_format.format(*num_frames_mapping)
2019-04-14 21:07:42 +02:00