update figure labels

This commit is contained in:
lorenzo 2019-07-26 09:20:30 +02:00
parent 26851351ee
commit 0ea3ae811f
5 changed files with 25 additions and 16 deletions

View File

@ -23,7 +23,7 @@ class EvalKitti:
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
CLUSTERS = ('easy', 'moderate', 'hard', 'all', '6', '10', '15', '20', '25', '30', '40', '50', '>50')
METHODS = ['m3d', 'geom', 'task_error', '3dop', 'our']
METHODS = ['m3d', 'md', 'geom', 'task_error', '3dop', 'our']
HEADERS = ['method', '<0.5', '<1m', '<2m', 'easy', 'moderate', 'hard', 'all']
CATEGORIES = ['pedestrian']
@ -157,8 +157,8 @@ class EvalKitti:
with open(path, "r") as ff:
for line in ff:
box = [float(x[:-1]) for x in line.split()[0:4]]
delta_h = (box[3] - box[1]) / 10 # TODO Add new value
delta_w = (box[2] - box[0]) / 10
delta_h = (box[3] - box[1]) / 7
delta_w = (box[2] - box[0]) / 3.5
assert delta_h > 0 and delta_w > 0, "Bounding box <=0"
box[0] -= delta_w
box[1] -= delta_h

View File

@ -21,7 +21,6 @@ def preprocess_monoloco(keypoints, kk):
uv_center = get_keypoints(keypoints, mode='center')
xy1_center = pixel_to_camera(uv_center, kk, 10)
xy1_all = pixel_to_camera(keypoints[:, 0:2, :], kk, 10)
# xy1_center[:, 1].fill_(0) #TODO
kps_norm = xy1_all - xy1_center.unsqueeze(1) # (m, 17, 3) - (m, 1, 3)
kps_out = kps_norm[:, :, 0:2].reshape(kps_norm.size()[0], -1) # no contiguous for view
return kps_out

View File

@ -1,5 +1,4 @@
# pylint: disable=too-many-branches, too-many-statements
import argparse
from openpifpaf.network import nets

View File

@ -5,4 +5,4 @@ from .kitti import check_conditions, get_category, split_training, parse_ground_
from .camera import xyz_from_distance, get_keypoints, pixel_to_camera, project_3d
from .logs import set_logger
from .stereo import depth_from_disparity
from ..utils.nuscenes import select_categories
from ..utils.nuscenes import select_categories

View File

@ -31,7 +31,7 @@ def show_results(dic_stats, show=False, save=False):
plt.figure(0)
plt.grid(linewidth=0.2)
plt.xlabel("Distance [meters]")
plt.xlabel("Ground-truth distance [m]")
plt.ylabel("Average localization error [m]")
plt.xlim(x_min, x_max)
labels = ['Mono3D', 'Geometric Baseline', 'MonoDepth', 'Our MonoLoco', '3DOP (stereo)']
@ -52,8 +52,10 @@ def show_results(dic_stats, show=False, save=False):
plt.legend(loc='upper left')
if show:
plt.show()
else:
plt.savefig(os.path.join(dir_out, 'results.png'))
if save:
path_fig = os.path.join(dir_out, 'results.png')
plt.savefig(path_fig)
print("Figure of results saved in {}".format(path_fig))
plt.close()
@ -104,13 +106,16 @@ def show_spread(dic_stats, show=False, save=False):
if show:
plt.show()
if save:
plt.savefig(os.path.join(dir_out, 'spread_bi.png'))
path_fig = os.path.join(dir_out, 'spread.png')
plt.savefig(path_fig)
print("Figure of confidence intervals saved in {}".format(path_fig))
plt.close()
def show_task_error(show, save):
"""Task error figure"""
plt.figure(2)
dir_out = 'docs'
xx = np.linspace(0, 40, 100)
mu_men = 178
mu_women = 165
@ -134,20 +139,23 @@ def show_task_error(show, save):
plt.plot(xx, yy_male, '-.', linewidth=1.7, color='b', label='Adult male')
plt.xlim(np.min(xx), np.max(xx))
plt.xlabel("Ground-truth distance from the camera $d_{gt}$ [m]")
plt.ylabel("Localization error $\hat{e}$ due to human height variation [m]")
plt.ylabel("Localization error $\hat{e}$ due to human height variation [m]") # pylint: disable=W1401
plt.legend(loc=(0.01, 0.55)) # Location from 0 to 1 from lower left
if show:
plt.show()
if save:
plt.savefig(os.path.join('docs', 'task_error.png'))
path_fig = os.path.join(dir_out, 'task_error.png')
plt.savefig(path_fig)
print("Figure of task error saved in {}".format(path_fig))
plt.close()
def show_method():
def show_method(save):
""" method figure"""
dir_out = 'docs'
std_1 = 0.75
fig = plt.figure(1)
ax = fig.add_subplot(1, 1, 1)
ell_3 = Ellipse((0, 2), width=std_1 * 2, height=0.3, angle=-90, color='b', fill=False, linewidth=2.5)
ell_4 = Ellipse((0, 2), width=std_1 * 3, height=0.3, angle=-90, color='r', fill=False,
linestyle='dashed', linewidth=2.5)
@ -162,7 +170,10 @@ def show_method():
plt.yticks([])
plt.xlabel('X [m]')
plt.ylabel('Z [m]')
plt.savefig(os.path.join('docs', 'output_method.png'))
if save:
path_fig = os.path.join(dir_out, 'output_method.png')
plt.savefig(path_fig)
print("Figure of method saved in {}".format(path_fig))
def target_error(xx, mm):