(
gt: Float[Tensor, "point 3"],
predicted: Float[Tensor, "point 3"],
)
| 5 | |
| 6 | |
| 7 | def compute_ate( |
| 8 | gt: Float[Tensor, "point 3"], |
| 9 | predicted: Float[Tensor, "point 3"], |
| 10 | ) -> tuple[ |
| 11 | Float[Tensor, ""], # ate |
| 12 | Float[Tensor, "point 3"], # aligned gt |
| 13 | Float[Tensor, "point 3"], # aligned predicted |
| 14 | ]: |
| 15 | aligned_gt, aligned_predicted, _ = spatial.procrustes( |
| 16 | gt.detach().cpu().numpy(), |
| 17 | predicted.cpu().numpy(), |
| 18 | ) |
| 19 | aligned_gt = torch.tensor(aligned_gt, dtype=torch.float32, device=gt.device) |
| 20 | aligned_predicted = torch.tensor( |
| 21 | aligned_predicted, dtype=torch.float32, device=predicted.device |
| 22 | ) |
| 23 | |
| 24 | ate = ((aligned_gt - aligned_predicted) ** 2).mean() ** 0.5 |
| 25 | return ate, aligned_gt, aligned_predicted |
no outgoing calls
no test coverage detected