Spaces:
Running on Zero
Running on Zero
Download utils/eval.py from daidedou/diffumatch: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/daidedou/diffumatch/resolve/3ccb54bbeec344157c8e15f61823efec01fdec05/utils/eval.py
- Command line
-
hf download hf://spaces/daidedou/diffumatch@3ccb54bbeec344157c8e15f61823efec01fdec05/utils/eval.py
-
curl -L -o eval.py https://huggingface.co/spaces/daidedou/diffumatch/resolve/3ccb54bbeec344157c8e15f61823efec01fdec05/utils/eval.py
1.08 kB
| def accuracy(p2p, gt_p2p, D1_geod, return_all=False, sqrt_area=None): | |
| """ | |
| Computes the geodesic accuracy of a vertex to vertex map. The map goes from | |
| the target shape to the source shape. | |
| Borrowed from Robin. | |
| Parameters | |
| ---------------------- | |
| p2p : (n2,) - vertex to vertex map giving the index of the matched vertex on the source shape | |
| for each vertex on the target shape (from a functional map point of view) | |
| gt_p2p : (n2,) - ground truth mapping between the pairs | |
| D1_geod : (n1,n1) - geodesic distance between pairs of vertices on the source mesh | |
| return_all : bool - whether to return all the distances or only the average geodesic distance | |
| Output | |
| ----------------------- | |
| acc : float - average accuracy of the vertex to vertex map | |
| dists : (n2,) - if return_all is True, returns all the pairwise distances | |
| """ | |
| dists = D1_geod[(p2p, gt_p2p)] | |
| if sqrt_area is not None: | |
| dists /= sqrt_area | |
| if return_all: | |
| return dists.mean(), dists | |
| return dists.mean() |