apply black 20.8b1 formatting update

Summary:
allow-large-files

black_any_style

Reviewed By: zertosh

Differential Revision: D24325133

fbshipit-source-id: b4afe80d1e8b2bc993f4b8e3822c02964df47462
This commit is contained in:
John Reese 2020-10-14 20:19:13 -07:00 committed by Facebook GitHub Bot
parent 11a9f5ea30
commit 2d39723610
8 changed files with 314 additions and 314 deletions

View File

@ -53,7 +53,7 @@ def _compute_alphas(x, c_world):
def _build_M(y, alphas, weight): def _build_M(y, alphas, weight):
""" Returns the matrix defining the reprojection equations. """Returns the matrix defining the reprojection equations.
Args: Args:
y: projected points in camera coordinates of size B x N x 2 y: projected points in camera coordinates of size B x N x 2
alphas: barycentric coordinates of size B x N x 4 alphas: barycentric coordinates of size B x N x 4
@ -90,7 +90,7 @@ def _build_M(y, alphas, weight):
def _null_space(m, kernel_dim): def _null_space(m, kernel_dim):
""" Finds the null space (kernel) basis of the matrix """Finds the null space (kernel) basis of the matrix
Args: Args:
m: the batch of input matrices, B x N x 12 m: the batch of input matrices, B x N x 12
kernel_dim: number of dimensions to approximate the kernel kernel_dim: number of dimensions to approximate the kernel
@ -106,7 +106,7 @@ def _null_space(m, kernel_dim):
def _reproj_error(y_hat, y, weight, eps=1e-9): def _reproj_error(y_hat, y, weight, eps=1e-9):
""" Projects estimated 3D points and computes the reprojection error """Projects estimated 3D points and computes the reprojection error
Args: Args:
y_hat: a batch of predicted 2D points in homogeneous coordinates y_hat: a batch of predicted 2D points in homogeneous coordinates
y: a batch of ground-truth 2D points y: a batch of ground-truth 2D points
@ -121,7 +121,7 @@ def _reproj_error(y_hat, y, weight, eps=1e-9):
def _algebraic_error(x_w_rotated, x_cam, weight): def _algebraic_error(x_w_rotated, x_cam, weight):
""" Computes the residual of Umeyama in 3D. """Computes the residual of Umeyama in 3D.
Args: Args:
x_w_rotated: The given 3D points rotated with the predicted camera. x_w_rotated: The given 3D points rotated with the predicted camera.
x_cam: the lifted 2D points y x_cam: the lifted 2D points y
@ -135,7 +135,7 @@ def _algebraic_error(x_w_rotated, x_cam, weight):
def _compute_norm_sign_scaling_factor(c_cam, alphas, x_world, y, weight, eps=1e-9): def _compute_norm_sign_scaling_factor(c_cam, alphas, x_world, y, weight, eps=1e-9):
""" Given a solution, adjusts the scale and flip """Given a solution, adjusts the scale and flip
Args: Args:
c_cam: control points in camera coordinates c_cam: control points in camera coordinates
alphas: barycentric coordinates of the points 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-
def _gen_pairs(input, dim=-2, reducer=lambda a, b: ((a - b) ** 2).sum(dim=-1)): def _gen_pairs(input, dim=-2, reducer=lambda a, b: ((a - b) ** 2).sum(dim=-1)):
""" Generates all pairs of different rows and then applies the reducer """Generates all pairs of different rows and then applies the reducer
Args: Args:
input: a tensor input: a tensor
dim: a dimension to generate pairs across 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)):
def _kernel_vec_distances(v): def _kernel_vec_distances(v):
""" Computes the coefficients for linearisation of the quadratic system """Computes the coefficients for linearisation of the quadratic system
to match all pairwise distances between 4 control points (dim=1). to match all pairwise distances between 4 control points (dim=1).
The last dimension corresponds to the coefficients for quadratic terms The last dimension corresponds to the coefficients for quadratic terms
Bij = Bi * Bj, where Bi and Bj correspond to kernel vectors. Bij = Bi * Bj, where Bi and Bj correspond to kernel vectors.
@ -208,7 +208,7 @@ def _kernel_vec_distances(v):
def _solve_lstsq_subcols(rhs, lhs, lhs_col_idx): def _solve_lstsq_subcols(rhs, lhs, lhs_col_idx):
""" Solves an over-determined linear system for selected LHS columns. """Solves an over-determined linear system for selected LHS columns.
A batched version of `torch.lstsq`. A batched version of `torch.lstsq`.
Args: Args:
rhs: right-hand side vectors rhs: right-hand side vectors
@ -226,7 +226,7 @@ def _binary_sign(t):
def _find_null_space_coords_1(kernel_dsts, cw_dst, eps=1e-9): def _find_null_space_coords_1(kernel_dsts, cw_dst, eps=1e-9):
""" Solves case 1 from the paper [1]; solve for 4 coefficients: """Solves case 1 from the paper [1]; solve for 4 coefficients:
[B11 B22 B33 B44 B12 B13 B14 B23 B24 B34] [B11 B22 B33 B44 B12 B13 B14 B23 B24 B34]
^ ^ ^ ^ ^ ^ ^ ^
Args: Args:
@ -246,7 +246,7 @@ def _find_null_space_coords_1(kernel_dsts, cw_dst, eps=1e-9):
def _find_null_space_coords_2(kernel_dsts, cw_dst): def _find_null_space_coords_2(kernel_dsts, cw_dst):
""" Solves case 2 from the paper; solve for 3 coefficients: """Solves case 2 from the paper; solve for 3 coefficients:
[B11 B22 B33 B44 B12 B13 B14 B23 B24 B34] [B11 B22 B33 B44 B12 B13 B14 B23 B24 B34]
^ ^ ^ ^ ^ ^
Args: Args:
@ -270,7 +270,7 @@ def _find_null_space_coords_2(kernel_dsts, cw_dst):
def _find_null_space_coords_3(kernel_dsts, cw_dst, eps=1e-9): def _find_null_space_coords_3(kernel_dsts, cw_dst, eps=1e-9):
""" Solves case 3 from the paper; solve for 5 coefficients: """Solves case 3 from the paper; solve for 5 coefficients:
[B11 B22 B33 B44 B12 B13 B14 B23 B24 B34] [B11 B22 B33 B44 B12 B13 B14 B23 B24 B34]
^ ^ ^ ^ ^ ^ ^ ^ ^ ^
Args: Args:

View File

@ -94,7 +94,7 @@ def convert_pointclouds_to_tensor(pcl: Union[torch.Tensor, "Pointclouds"]):
def is_pointclouds(pcl: Union[torch.Tensor, "Pointclouds"]): def is_pointclouds(pcl: Union[torch.Tensor, "Pointclouds"]):
""" Checks whether the input `pcl` is an instance of `Pointclouds` """Checks whether the input `pcl` is an instance of `Pointclouds`
by checking the existence of `points_padded` and `num_points_per_cloud` by checking the existence of `points_padded` and `num_points_per_cloud`
functions. functions.
""" """

View File

@ -346,7 +346,7 @@ class SoftSilhouetteShader(nn.Module):
self.blend_params = blend_params if blend_params is not None else BlendParams() self.blend_params = blend_params if blend_params is not None else BlendParams()
def forward(self, fragments, meshes, **kwargs) -> torch.Tensor: def forward(self, fragments, meshes, **kwargs) -> torch.Tensor:
"""" """ "
Only want to render the silhouette so RGB values can be ones. Only want to render the silhouette so RGB values can be ones.
There is no need for lighting or texturing There is no need for lighting or texturing
""" """

View File

@ -111,9 +111,9 @@ def _try_place_rectangle(
| |3 | | |3 |
| | | | | |
+-----------------------+----+------X +-----------------------+----+------X
y |1 | y |1 |
^ | --->x | ^ | --->x |
| +-----------------------------------+ | +-----------------------------------+
We want to place this rectangle. We want to place this rectangle.