Convert Rotation matrix to quaternion, then calculate the location errors. original from PoseNet Paper
(args, dl, model, sample_size, device, batch_size=1)
| 115 | |
| 116 | # # pytorch |
| 117 | def get_error_in_q(args, dl, model, sample_size, device, batch_size=1): |
| 118 | ''' Convert Rotation matrix to quaternion, then calculate the location errors. original from PoseNet Paper ''' |
| 119 | model.eval() |
| 120 | |
| 121 | results = np.zeros((sample_size, 2)) |
| 122 | results, vis_info = compute_error_in_q(args, dl, model, device, results, batch_size) |
| 123 | median_result = np.median(results,axis=0) |
| 124 | mean_result = np.mean(results,axis=0) |
| 125 | |
| 126 | # standard log |
| 127 | print ('Median error {}m and {} degrees.'.format(median_result[0], median_result[1])) |
| 128 | print ('Mean error {}m and {} degrees.'.format(mean_result[0], mean_result[1])) |
| 129 | |
| 130 | # visualize results |
| 131 | # vis_pose(vis_info) |
| 132 | |
| 133 | def get_render_error_in_q(args, model, sample_size, device, targets, rgbs, poses, batch_size=1): |
| 134 | ''' use nerf render imgs instead of use real imgs ''' |
no test coverage detected