evaluation scripts
This commit is contained in:
@@ -8,6 +8,7 @@ import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import yaml
|
||||
import argparse
|
||||
import svo_analysis.analyse_depth as analyse_depth
|
||||
from matplotlib import rc
|
||||
|
||||
# tell matplotlib to use latex font
|
||||
@@ -43,6 +44,7 @@ def compare_results(comp_params, results_dir, comparison_dir):
|
||||
print('run comparison: '+comp_params['comparison_name'])
|
||||
|
||||
line_styles = ['-','--',':']
|
||||
line_colors = ['b','g','r','m','c']
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# plot trajectory:
|
||||
@@ -57,10 +59,9 @@ def compare_results(comp_params, results_dir, comparison_dir):
|
||||
base_plot, = ax.plot(data[:,1], data[:,2], label=exp_set['label'], linestyle=line_styles[np.mod(i, len(line_styles))])
|
||||
else:
|
||||
ax.plot(data[:,1], data[:,2], color=base_plot.get_color(), linestyle= line_styles[np.mod(i, len(line_styles))])
|
||||
ax.legend(loc='upper left', ncol=2)
|
||||
ax.legend(loc='upper left', ncol=3)
|
||||
save_figure(fig, 'trajectory', comparison_dir)
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# plot translation error:
|
||||
fig = plt.figure(figsize=(6,2))
|
||||
@@ -93,8 +94,27 @@ def compare_results(comp_params, results_dir, comparison_dir):
|
||||
else:
|
||||
ax.plot(distances, e*1000, color=base_plot.get_color(), linestyle= line_styles[np.mod(i, len(line_styles))])
|
||||
|
||||
ax.legend(loc='upper left', ncol=2)
|
||||
ax.legend(loc='upper left', ncol=3)
|
||||
save_figure(fig, 'translation_error', comparison_dir)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# plot depth estimation error:
|
||||
fig = plt.figure(figsize=(6,5))
|
||||
ax = fig.add_subplot(111, xlabel='Error [m]', ylabel='Precision [\%]')
|
||||
for k, exp_set in enumerate(comp_params['experiment_sets']):
|
||||
print('plot depth error for experiment: ' + exp_set['label'])
|
||||
|
||||
for i, exp in enumerate(exp_set['experiments']):
|
||||
|
||||
D = np.loadtxt(os.path.join(results_dir, exp, 'depth_error.txt'), delimiter=' ')
|
||||
D = D[np.logical_and(D[:,0] > 1, D[:,0] < D[-1,0]/4),:]
|
||||
errors = np.abs(D[:,1])
|
||||
if i == 0:
|
||||
base_plot = analyse_depth.precision_plot(ax, errors, 0.05, line_colors[k], line_styles[np.mod(i, len(line_styles))])
|
||||
else:
|
||||
base_plot = analyse_depth.precision_plot(ax, errors, 0.05, base_plot.get_color(), line_styles[np.mod(i, len(line_styles))])
|
||||
|
||||
save_figure(fig, 'depth_error', comparison_dir)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
|
||||
@@ -10,41 +10,49 @@ import csv
|
||||
import numpy as np
|
||||
import rospkg
|
||||
import argparse
|
||||
import yaml
|
||||
import svo_analysis.analyse_logs as analyse_logs
|
||||
import svo_analysis.analyse_timing as analyse_timing
|
||||
import svo_analysis.analyse_trajectory as analyse_trajectory
|
||||
import svo_analysis.analyse_depth as analyse_depth
|
||||
|
||||
def evaluate_dataset(trace_dir):
|
||||
|
||||
# read tracefile
|
||||
data = csv.reader(open(os.path.join(trace_dir, 'trace.csv')))
|
||||
fields = data.next()
|
||||
D = dict()
|
||||
for field in fields:
|
||||
D[field] = list()
|
||||
# read tracefile
|
||||
data = csv.reader(open(os.path.join(trace_dir, 'trace.csv')))
|
||||
fields = data.next()
|
||||
D = dict()
|
||||
for field in fields:
|
||||
D[field] = list()
|
||||
|
||||
# fill dictionary with column values
|
||||
for row in data:
|
||||
for (field, value) in zip(fields, row):
|
||||
D[field].append(float(value))
|
||||
# fill dictionary with column values
|
||||
for row in data:
|
||||
for (field, value) in zip(fields, row):
|
||||
D[field].append(float(value))
|
||||
|
||||
# change dictionary values from list to numpy array for easier manipulation
|
||||
for field, value in D.items():
|
||||
D[field] = np.array(D[field])
|
||||
# change dictionary values from list to numpy array for easier manipulation
|
||||
for field, value in D.items():
|
||||
D[field] = np.array(D[field])
|
||||
|
||||
# generate plots
|
||||
analyse_logs.analyse_logs(D, trace_dir)
|
||||
analyse_timing.analyse_timing(D, trace_dir)
|
||||
analyse_trajectory.analyse_trajectory(trace_dir)
|
||||
|
||||
param = yaml.load(open(os.path.join(trace_dir, 'dataset_params.yaml'), 'r'))
|
||||
if param['dataset_is_blender']:
|
||||
analyse_depth.analyse_depth(trace_dir)
|
||||
analyse_depth.analyse_depth_over_time(trace_dir)
|
||||
|
||||
# generate plots
|
||||
analyse_logs.analyse_logs(D, trace_dir)
|
||||
analyse_timing.analyse_timing(D, trace_dir)
|
||||
analyse_trajectory.analyse_trajectory(trace_dir)
|
||||
|
||||
if __name__=="__main__":
|
||||
parser = argparse.ArgumentParser(description='''
|
||||
Evaluates tracefiles of SVO and generates the plots.
|
||||
''')
|
||||
parser.add_argument('experiment_name', help='directory name of the tracefiles')
|
||||
args = parser.parse_args()
|
||||
parser = argparse.ArgumentParser(description='''
|
||||
Evaluates tracefiles of SVO and generates the plots.
|
||||
''')
|
||||
parser.add_argument('experiment_name', help='directory name of the tracefiles')
|
||||
args = parser.parse_args()
|
||||
|
||||
trace_dir = os.path.join(rospkg.RosPack().get_path('svo_analysis'),
|
||||
'results',
|
||||
args.experiment_name)
|
||||
evaluate_dataset(trace_dir)
|
||||
trace_dir = os.path.join(rospkg.RosPack().get_path('svo_analysis'),
|
||||
'results',
|
||||
args.experiment_name)
|
||||
evaluate_dataset(trace_dir)
|
||||
Reference in New Issue
Block a user