(self, outs, cur_sample_idx)
| 70 | |
| 71 | |
| 72 | def evaluate(self, outs, cur_sample_idx): |
| 73 | annots = self.datalist |
| 74 | sample_num = len(outs) |
| 75 | eval_result = { |
| 76 | 'pa_mpvpe_all': [], |
| 77 | 'pa_mpvpe_l_hand': [], |
| 78 | 'pa_mpvpe_r_hand': [], |
| 79 | 'pa_mpvpe_hand': [], |
| 80 | 'pa_mpvpe_face': [], |
| 81 | 'mpvpe_all': [], |
| 82 | 'mpvpe_l_hand': [], |
| 83 | 'mpvpe_r_hand': [], |
| 84 | 'mpvpe_hand': [], |
| 85 | 'mpvpe_face': [] |
| 86 | } |
| 87 | |
| 88 | vis = getattr(cfg, 'vis', False) |
| 89 | vis_save_dir = cfg.vis_dir |
| 90 | |
| 91 | for n in range(sample_num): |
| 92 | |
| 93 | out = outs[n] |
| 94 | mesh_gt = out['smplx_mesh_cam_target'] |
| 95 | mesh_out = out['smplx_mesh_cam'] |
| 96 | cam_trans = out['cam_trans'] |
| 97 | joint_proj = out['smplx_joint_proj'] |
| 98 | img_wh = (out['img_shape']) |
| 99 | ann_idx = out['gt_ann_idx'] |
| 100 | img_path = [] |
| 101 | for ann_id in ann_idx: |
| 102 | img_path.append(annots[ann_id]['img_path']) |
| 103 | # print(img_path) |
| 104 | eval_result['img_path'] = img_path |
| 105 | eval_result['ann_idx'] = ann_idx |
| 106 | |
| 107 | # MPVPE from all vertices |
| 108 | joint_gt_body_wo_trans = np.dot(smpl_x.j14_regressor, |
| 109 | mesh_gt).transpose(1,0,2) |
| 110 | joint_gt_body_proj = project_points_new( |
| 111 | points_3d=torch.Tensor(joint_gt_body_wo_trans), |
| 112 | pred_cam=torch.Tensor(cam_trans), |
| 113 | focal_length=5000, |
| 114 | camera_center=torch.Tensor(img_wh/2) |
| 115 | ) # origin image space |
| 116 | |
| 117 | |
| 118 | |
| 119 | joint_gt_lhand_wo_trans = np.dot( |
| 120 | smpl_x.orig_hand_regressor['left'], mesh_gt).transpose(1,0,2) |
| 121 | joint_gt_lhand_proj = project_points_new( |
| 122 | points_3d=torch.Tensor(joint_gt_lhand_wo_trans), |
| 123 | pred_cam=torch.Tensor(cam_trans), |
| 124 | focal_length=5000, |
| 125 | camera_center=torch.Tensor(img_wh/2) |
| 126 | ) # origin image space |
| 127 | joint_gt_rhand_wo_trans = np.dot( |
| 128 | smpl_x.orig_hand_regressor['left'], mesh_gt).transpose(1,0,2) |
| 129 | joint_gt_rhand_proj = project_points_new( |
nothing calls this directly
no test coverage detected