This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Retrieve the array key corresponding to the largest element in the array. | |
| * | |
| * @param {Array.<number>} array Input array | |
| * @return {number} Index of array element with largest value | |
| */ | |
| function argMax(array) { | |
| return array.map((x, i) => [x, i]).reduce((r, a) => (a[0] > r[0] ? a : r))[1]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import torch | |
| def compute_similarity_transform(S1, S2): | |
| ''' | |
| Computes a similarity transform (sR, t) that takes | |
| a set of 3D points S1 (3 x N) closest to a set of 3D points S2, | |
| where R is an 3x3 rotation matrix, t 3x1 translation, s scale. | |
| i.e. solves the orthogonal Procrutes problem. | |
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from sklearn.neighbors import NearestNeighbors | |
| def chamfer_distance(x, y, metric='l2', direction='bi'): | |
| """Chamfer distance between two point clouds | |
| Parameters | |
| ---------- | |
| x: numpy array [n_points_x, n_dims] |
OlderNewer