@@ -53,7 +53,7 @@ def _compute_alphas(x, c_world):
53
53
54
54
55
55
def _build_M (y , alphas , weight ):
56
- """ Returns the matrix defining the reprojection equations.
56
+ """Returns the matrix defining the reprojection equations.
57
57
Args:
58
58
y: projected points in camera coordinates of size B x N x 2
59
59
alphas: barycentric coordinates of size B x N x 4
@@ -90,7 +90,7 @@ def lm_alphas(t):
90
90
91
91
92
92
def _null_space (m , kernel_dim ):
93
- """ Finds the null space (kernel) basis of the matrix
93
+ """Finds the null space (kernel) basis of the matrix
94
94
Args:
95
95
m: the batch of input matrices, B x N x 12
96
96
kernel_dim: number of dimensions to approximate the kernel
@@ -106,7 +106,7 @@ def _null_space(m, kernel_dim):
106
106
107
107
108
108
def _reproj_error (y_hat , y , weight , eps = 1e-9 ):
109
- """ Projects estimated 3D points and computes the reprojection error
109
+ """Projects estimated 3D points and computes the reprojection error
110
110
Args:
111
111
y_hat: a batch of predicted 2D points in homogeneous coordinates
112
112
y: a batch of ground-truth 2D points
@@ -121,7 +121,7 @@ def _reproj_error(y_hat, y, weight, eps=1e-9):
121
121
122
122
123
123
def _algebraic_error (x_w_rotated , x_cam , weight ):
124
- """ Computes the residual of Umeyama in 3D.
124
+ """Computes the residual of Umeyama in 3D.
125
125
Args:
126
126
x_w_rotated: The given 3D points rotated with the predicted camera.
127
127
x_cam: the lifted 2D points y
@@ -135,7 +135,7 @@ def _algebraic_error(x_w_rotated, x_cam, weight):
135
135
136
136
137
137
def _compute_norm_sign_scaling_factor (c_cam , alphas , x_world , y , weight , eps = 1e-9 ):
138
- """ Given a solution, adjusts the scale and flip
138
+ """Given a solution, adjusts the scale and flip
139
139
Args:
140
140
c_cam: control points in camera coordinates
141
141
alphas: barycentric coordinates of the points
@@ -167,7 +167,7 @@ def _compute_norm_sign_scaling_factor(c_cam, alphas, x_world, y, weight, eps=1e-
167
167
168
168
169
169
def _gen_pairs (input , dim = - 2 , reducer = lambda a , b : ((a - b ) ** 2 ).sum (dim = - 1 )):
170
- """ Generates all pairs of different rows and then applies the reducer
170
+ """Generates all pairs of different rows and then applies the reducer
171
171
Args:
172
172
input: a tensor
173
173
dim: a dimension to generate pairs across
@@ -184,7 +184,7 @@ def _gen_pairs(input, dim=-2, reducer=lambda a, b: ((a - b) ** 2).sum(dim=-1)):
184
184
185
185
186
186
def _kernel_vec_distances (v ):
187
- """ Computes the coefficients for linearisation of the quadratic system
187
+ """Computes the coefficients for linearisation of the quadratic system
188
188
to match all pairwise distances between 4 control points (dim=1).
189
189
The last dimension corresponds to the coefficients for quadratic terms
190
190
Bij = Bi * Bj, where Bi and Bj correspond to kernel vectors.
@@ -208,7 +208,7 @@ def _kernel_vec_distances(v):
208
208
209
209
210
210
def _solve_lstsq_subcols (rhs , lhs , lhs_col_idx ):
211
- """ Solves an over-determined linear system for selected LHS columns.
211
+ """Solves an over-determined linear system for selected LHS columns.
212
212
A batched version of `torch.lstsq`.
213
213
Args:
214
214
rhs: right-hand side vectors
@@ -226,7 +226,7 @@ def _binary_sign(t):
226
226
227
227
228
228
def _find_null_space_coords_1 (kernel_dsts , cw_dst , eps = 1e-9 ):
229
- """ Solves case 1 from the paper [1]; solve for 4 coefficients:
229
+ """Solves case 1 from the paper [1]; solve for 4 coefficients:
230
230
[B11 B22 B33 B44 B12 B13 B14 B23 B24 B34]
231
231
^ ^ ^ ^
232
232
Args:
@@ -246,7 +246,7 @@ def _find_null_space_coords_1(kernel_dsts, cw_dst, eps=1e-9):
246
246
247
247
248
248
def _find_null_space_coords_2 (kernel_dsts , cw_dst ):
249
- """ Solves case 2 from the paper; solve for 3 coefficients:
249
+ """Solves case 2 from the paper; solve for 3 coefficients:
250
250
[B11 B22 B33 B44 B12 B13 B14 B23 B24 B34]
251
251
^ ^ ^
252
252
Args:
@@ -270,7 +270,7 @@ def _find_null_space_coords_2(kernel_dsts, cw_dst):
270
270
271
271
272
272
def _find_null_space_coords_3 (kernel_dsts , cw_dst , eps = 1e-9 ):
273
- """ Solves case 3 from the paper; solve for 5 coefficients:
273
+ """Solves case 3 from the paper; solve for 5 coefficients:
274
274
[B11 B22 B33 B44 B12 B13 B14 B23 B24 B34]
275
275
^ ^ ^ ^ ^
276
276
Args:
0 commit comments