MCPcopy Create free account
hub / github.com/dcharatan/flowmap / compute_ate

Function compute_ate

flowmap/misc/ate.py:7–25  ·  view source on GitHub ↗
(
    gt: Float[Tensor, "point 3"],
    predicted: Float[Tensor, "point 3"],
)

Source from the content-addressed store, hash-verified

5
6
7def 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

Callers 2

load_metricsFunction · 0.90
visualizeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected