update figure labels
This commit is contained in:
parent
26851351ee
commit
0ea3ae811f
@ -23,7 +23,7 @@ class EvalKitti:
|
|||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
CLUSTERS = ('easy', 'moderate', 'hard', 'all', '6', '10', '15', '20', '25', '30', '40', '50', '>50')
|
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']
|
HEADERS = ['method', '<0.5', '<1m', '<2m', 'easy', 'moderate', 'hard', 'all']
|
||||||
CATEGORIES = ['pedestrian']
|
CATEGORIES = ['pedestrian']
|
||||||
|
|
||||||
@ -157,8 +157,8 @@ class EvalKitti:
|
|||||||
with open(path, "r") as ff:
|
with open(path, "r") as ff:
|
||||||
for line in ff:
|
for line in ff:
|
||||||
box = [float(x[:-1]) for x in line.split()[0:4]]
|
box = [float(x[:-1]) for x in line.split()[0:4]]
|
||||||
delta_h = (box[3] - box[1]) / 10 # TODO Add new value
|
delta_h = (box[3] - box[1]) / 7
|
||||||
delta_w = (box[2] - box[0]) / 10
|
delta_w = (box[2] - box[0]) / 3.5
|
||||||
assert delta_h > 0 and delta_w > 0, "Bounding box <=0"
|
assert delta_h > 0 and delta_w > 0, "Bounding box <=0"
|
||||||
box[0] -= delta_w
|
box[0] -= delta_w
|
||||||
box[1] -= delta_h
|
box[1] -= delta_h
|
||||||
|
|||||||
@ -21,7 +21,6 @@ def preprocess_monoloco(keypoints, kk):
|
|||||||
uv_center = get_keypoints(keypoints, mode='center')
|
uv_center = get_keypoints(keypoints, mode='center')
|
||||||
xy1_center = pixel_to_camera(uv_center, kk, 10)
|
xy1_center = pixel_to_camera(uv_center, kk, 10)
|
||||||
xy1_all = pixel_to_camera(keypoints[:, 0:2, :], 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_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
|
kps_out = kps_norm[:, :, 0:2].reshape(kps_norm.size()[0], -1) # no contiguous for view
|
||||||
return kps_out
|
return kps_out
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
# pylint: disable=too-many-branches, too-many-statements
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from openpifpaf.network import nets
|
from openpifpaf.network import nets
|
||||||
|
|||||||
@ -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 .camera import xyz_from_distance, get_keypoints, pixel_to_camera, project_3d
|
||||||
from .logs import set_logger
|
from .logs import set_logger
|
||||||
from .stereo import depth_from_disparity
|
from .stereo import depth_from_disparity
|
||||||
from ..utils.nuscenes import select_categories
|
from ..utils.nuscenes import select_categories
|
||||||
|
|||||||
@ -31,7 +31,7 @@ def show_results(dic_stats, show=False, save=False):
|
|||||||
|
|
||||||
plt.figure(0)
|
plt.figure(0)
|
||||||
plt.grid(linewidth=0.2)
|
plt.grid(linewidth=0.2)
|
||||||
plt.xlabel("Distance [meters]")
|
plt.xlabel("Ground-truth distance [m]")
|
||||||
plt.ylabel("Average localization error [m]")
|
plt.ylabel("Average localization error [m]")
|
||||||
plt.xlim(x_min, x_max)
|
plt.xlim(x_min, x_max)
|
||||||
labels = ['Mono3D', 'Geometric Baseline', 'MonoDepth', 'Our MonoLoco', '3DOP (stereo)']
|
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')
|
plt.legend(loc='upper left')
|
||||||
if show:
|
if show:
|
||||||
plt.show()
|
plt.show()
|
||||||
else:
|
if save:
|
||||||
plt.savefig(os.path.join(dir_out, 'results.png'))
|
path_fig = os.path.join(dir_out, 'results.png')
|
||||||
|
plt.savefig(path_fig)
|
||||||
|
print("Figure of results saved in {}".format(path_fig))
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
|
|
||||||
@ -104,13 +106,16 @@ def show_spread(dic_stats, show=False, save=False):
|
|||||||
if show:
|
if show:
|
||||||
plt.show()
|
plt.show()
|
||||||
if save:
|
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()
|
plt.close()
|
||||||
|
|
||||||
|
|
||||||
def show_task_error(show, save):
|
def show_task_error(show, save):
|
||||||
"""Task error figure"""
|
"""Task error figure"""
|
||||||
plt.figure(2)
|
plt.figure(2)
|
||||||
|
dir_out = 'docs'
|
||||||
xx = np.linspace(0, 40, 100)
|
xx = np.linspace(0, 40, 100)
|
||||||
mu_men = 178
|
mu_men = 178
|
||||||
mu_women = 165
|
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.plot(xx, yy_male, '-.', linewidth=1.7, color='b', label='Adult male')
|
||||||
plt.xlim(np.min(xx), np.max(xx))
|
plt.xlim(np.min(xx), np.max(xx))
|
||||||
plt.xlabel("Ground-truth distance from the camera $d_{gt}$ [m]")
|
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
|
plt.legend(loc=(0.01, 0.55)) # Location from 0 to 1 from lower left
|
||||||
if show:
|
if show:
|
||||||
plt.show()
|
plt.show()
|
||||||
if save:
|
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"""
|
""" method figure"""
|
||||||
|
dir_out = 'docs'
|
||||||
std_1 = 0.75
|
std_1 = 0.75
|
||||||
fig = plt.figure(1)
|
fig = plt.figure(1)
|
||||||
ax = fig.add_subplot(1, 1, 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_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,
|
ell_4 = Ellipse((0, 2), width=std_1 * 3, height=0.3, angle=-90, color='r', fill=False,
|
||||||
linestyle='dashed', linewidth=2.5)
|
linestyle='dashed', linewidth=2.5)
|
||||||
@ -162,7 +170,10 @@ def show_method():
|
|||||||
plt.yticks([])
|
plt.yticks([])
|
||||||
plt.xlabel('X [m]')
|
plt.xlabel('X [m]')
|
||||||
plt.ylabel('Z [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):
|
def target_error(xx, mm):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user