in contactopt/geometric_eval.py [0:0]
def geometric_eval(ho_test, ho_gt):
"""
Computes many statistics about ground truth and HO
Note that official HO-3D metrics are available here, but they only consider the hand, and I think they do too much alignment
https://github.com/shreyashampali/ho3d/blob/master/eval.py
:param ho_test: hand-object under test
:param ho_gt: ground-truth hand-object
:return: dictionary of stats
"""
stats = dict()
stats['unalign_hand_verts'] = util.calc_l2_err(ho_gt.hand_verts, ho_test.hand_verts, axis=1)
stats['unalign_hand_joints'] = util.calc_l2_err(ho_gt.hand_joints, ho_test.hand_joints, axis=1)
stats['unalign_obj_verts'] = util.calc_l2_err(ho_gt.obj_verts, ho_test.obj_verts, axis=1)
root_test = ho_test.hand_joints[0, :]
root_gt = ho_gt.hand_joints[0, :]
stats['rootalign_hand_joints'] = util.calc_l2_err(ho_gt.hand_joints - root_gt, ho_test.hand_joints - root_test, axis=1)
stats['rootalign_obj_verts'] = util.calc_l2_err(ho_gt.obj_verts - root_gt, ho_test.obj_verts - root_test, axis=1)
obj_cent_gt = ho_gt.obj_verts.mean(0)
obj_cent_test = ho_test.obj_verts.mean(0)
stats['objalign_hand_joints'] = util.calc_l2_err(ho_gt.hand_joints - obj_cent_gt, ho_test.hand_joints - obj_cent_test, axis=1)
hand_joints_align_gt = np_apply_tform(ho_gt.hand_joints, get_hand_align_tform(ho_gt.hand_joints))
hand_joints_align_test = np_apply_tform(ho_test.hand_joints, get_hand_align_tform(ho_test.hand_joints))
hand_verts_align_gt = np_apply_tform(ho_gt.hand_verts, get_hand_align_tform(ho_gt.hand_joints))
hand_verts_align_test = np_apply_tform(ho_test.hand_verts, get_hand_align_tform(ho_test.hand_joints))
stats['handalign_hand_joints'] = util.calc_l2_err(hand_joints_align_gt, hand_joints_align_test, axis=1)
stats['handalign_hand_verts'] = util.calc_l2_err(hand_verts_align_gt, hand_verts_align_test, axis=1)
stats['verts'] = ho_gt.obj_verts.shape[0]
return stats