Skip to content

Commit

Permalink
Update smpl_augmentation.py
Browse files Browse the repository at this point in the history
  • Loading branch information
akashsengupta1997 committed Mar 21, 2022
1 parent d068abc commit 9893133
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions utils/augmentation/smpl_augmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,9 @@ def normal_sample_shape(batch_size, mean_shape, std_vector):
return shape # (bs, num_smpl_betas)


def uniform_random_rot_matrix(num_matrices, std=0.01):
"""
Uniform sampling of random 3D rotation matrices using QR decomposition.
Source: https://arxiv.org/pdf/math-ph/0609050.pdf
"""
Z = torch.randn(num_matrices, 3, 3) * std
Q, R = torch.qr(Z)
d = torch.diagonal(R)
ph = d/torch.abs(d)
# matmul with diagonal matrix L equivalent to element-wise mul with broad-casted vector l
Q = torch.mul(Q, ph)
return Q # (num_matrices, 3, 3)


def uniform_random_unit_vector(num_vectors):
"""
Uniform sampling random 3D unit-vectors, i.e. points on surface of unit sphere.
Uniform sampling random 3D unit-vectors, i.e. points on unit sphere.
"""
e = torch.randn(num_vectors, 3)
e = torch.div(e, torch.norm(e, dim=-1, keepdim=True))
Expand Down

0 comments on commit 9893133

Please sign in to comment.