MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / evaluate

Method evaluate

datasets/humandata.py:966–1177  ·  view source on GitHub ↗
(self, outs, cur_sample_idx=None)

Source from the content-addressed store, hash-verified

964 return bbox, bbox_valid
965
966 def evaluate(self, outs, cur_sample_idx=None):
967 annots = self.datalist
968 sample_num = len(outs)
969 eval_result = {
970 'pa_mpvpe_all': [],
971 'pa_mpvpe_l_hand': [],
972 'pa_mpvpe_r_hand': [],
973 'pa_mpvpe_hand': [],
974 'pa_mpvpe_face': [],
975 'mpvpe_all': [],
976 'mpvpe_l_hand': [],
977 'mpvpe_r_hand': [],
978 'mpvpe_hand': [],
979 'mpvpe_face': [],
980 'pa_mpjpe_body': [],
981 'pa_mpjpe_l_hand': [],
982 'pa_mpjpe_r_hand': [],
983 'pa_mpjpe_hand': []
984 }
985
986 for n in range(sample_num):
987 out = outs[n]
988 ann_idx = out['gt_ann_idx']
989 mesh_gt = out['smplx_mesh_cam_pseudo_gt']
990 mesh_out = out['smplx_mesh_cam']
991 cam_trans = out['cam_trans']
992 ann_idx = out['gt_ann_idx']
993 img_path = []
994 for ann_id in ann_idx:
995 img_path.append(annots[ann_id]['img_path'])
996 eval_result['img_path'] = img_path
997 eval_result['ann_idx'] = ann_idx
998
999 img = out['img']
1000 # MPVPE from all vertices
1001 mesh_out_align = mesh_out - np.dot(
1002 smpl_x.J_regressor,
1003 mesh_out)[smpl_x.J_regressor_idx['pelvis'], None, :] + np.dot(
1004 smpl_x.J_regressor,
1005 mesh_gt)[smpl_x.J_regressor_idx['pelvis'], None, :]
1006 eval_result['mpvpe_all'].append(
1007 np.sqrt(np.sum(
1008 (mesh_out_align - mesh_gt)**2, 1)).mean() * 1000)
1009 mesh_out_align = rigid_align(mesh_out, mesh_gt)
1010 eval_result['pa_mpvpe_all'].append(
1011 np.sqrt(np.sum(
1012 (mesh_out_align - mesh_gt)**2, 1)).mean() * 1000)
1013 # MPVPE from hand vertices
1014 mesh_gt_lhand = mesh_gt[smpl_x.hand_vertex_idx['left_hand'], :]
1015 mesh_out_lhand = mesh_out[smpl_x.hand_vertex_idx['left_hand'], :]
1016 mesh_gt_rhand = mesh_gt[smpl_x.hand_vertex_idx['right_hand'], :]
1017 mesh_out_rhand = mesh_out[smpl_x.hand_vertex_idx['right_hand'], :]
1018 mesh_out_lhand_align = mesh_out_lhand - np.dot(
1019 smpl_x.J_regressor,
1020 mesh_out)[smpl_x.J_regressor_idx['lwrist'], None, :] + np.dot(
1021 smpl_x.J_regressor,
1022 mesh_gt)[smpl_x.J_regressor_idx['lwrist'], None, :]
1023 mesh_out_rhand_align = mesh_out_rhand - np.dot(

Callers

nothing calls this directly

Calls 2

rigid_alignFunction · 0.90
project_points_newFunction · 0.90

Tested by

no test coverage detected