| 1028 | result = self.format(result) |
| 1029 | return result |
| 1030 | def print_eval_result(self, eval_result): |
| 1031 | |
| 1032 | print('UBody test results are dumped at: ' + |
| 1033 | osp.join(cfg.result_dir, 'predictions')) |
| 1034 | |
| 1035 | if self.data_split == 'test' and self.test_set == 'test': # do not print. just submit the results to the official evaluation server |
| 1036 | return |
| 1037 | |
| 1038 | print('======UBody-val======') |
| 1039 | print('PA MPVPE (All): %.2f mm' % np.mean(eval_result['pa_mpvpe_all'])) |
| 1040 | print('PA MPVPE (L-Hands): %.2f mm' % |
| 1041 | np.mean(eval_result['pa_mpvpe_l_hand'])) |
| 1042 | print('PA MPVPE (R-Hands): %.2f mm' % |
| 1043 | np.mean(eval_result['pa_mpvpe_r_hand'])) |
| 1044 | print('PA MPVPE (Hands): %.2f mm' % |
| 1045 | np.mean(eval_result['pa_mpvpe_hand'])) |
| 1046 | print('PA MPVPE (Face): %.2f mm' % |
| 1047 | np.mean(eval_result['pa_mpvpe_face'])) |
| 1048 | print() |
| 1049 | |
| 1050 | print('MPVPE (All): %.2f mm' % np.mean(eval_result['mpvpe_all'])) |
| 1051 | print('MPVPE (L-Hands): %.2f mm' % |
| 1052 | np.mean(eval_result['mpvpe_l_hand'])) |
| 1053 | print('MPVPE (R-Hands): %.2f mm' % |
| 1054 | np.mean(eval_result['mpvpe_r_hand'])) |
| 1055 | print('MPVPE (Hands): %.2f mm' % np.mean(eval_result['mpvpe_hand'])) |
| 1056 | print('MPVPE (Face): %.2f mm' % np.mean(eval_result['mpvpe_face'])) |
| 1057 | |
| 1058 | f = open(os.path.join(cfg.result_dir, 'result.txt'), 'w') |
| 1059 | f.write(f'UBody-val dataset: \n') |
| 1060 | f.write('PA MPVPE (All): %.2f mm\n' % |
| 1061 | np.mean(eval_result['pa_mpvpe_all'])) |
| 1062 | f.write('PA MPVPE (L-Hands): %.2f mm' % |
| 1063 | np.mean(eval_result['pa_mpvpe_l_hand'])) |
| 1064 | f.write('PA MPVPE (R-Hands): %.2f mm' % |
| 1065 | np.mean(eval_result['pa_mpvpe_r_hand'])) |
| 1066 | f.write('PA MPVPE (Hands): %.2f mm\n' % |
| 1067 | np.mean(eval_result['pa_mpvpe_hand'])) |
| 1068 | f.write('PA MPVPE (Face): %.2f mm\n' % |
| 1069 | np.mean(eval_result['pa_mpvpe_face'])) |
| 1070 | f.write('MPVPE (All): %.2f mm\n' % np.mean(eval_result['mpvpe_all'])) |
| 1071 | f.write('MPVPE (L-Hands): %.2f mm' % |
| 1072 | np.mean(eval_result['mpvpe_l_hand'])) |
| 1073 | f.write('MPVPE (R-Hands): %.2f mm' % |
| 1074 | np.mean(eval_result['mpvpe_r_hand'])) |
| 1075 | f.write('MPVPE (Hands): %.2f mm' % np.mean(eval_result['mpvpe_hand'])) |
| 1076 | f.write('MPVPE (Face): %.2f mm\n' % np.mean(eval_result['mpvpe_face'])) |