mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-20 22:30:35 +08:00
Efficient PnP weighting bug fix
Summary: There is a bug in efficient PnP that incorrectly weights points. This fixes it. The test does not pass for the previous version with the bug. Reviewed By: shapovalov Differential Revision: D22449357 fbshipit-source-id: f5a22081e91d25681a6a783cce2f5c6be429ca6a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2f3cd98725
commit
daf9eac801
@@ -66,6 +66,10 @@ def _build_M(y, alphas, weight):
|
||||
def prepad(t, v):
|
||||
return F.pad(t, (1, 0), value=v)
|
||||
|
||||
if weight is not None:
|
||||
# weight the alphas in order to get a correctly weighted version of M
|
||||
alphas = alphas * weight[:, :, None]
|
||||
|
||||
# outer left-multiply by alphas
|
||||
def lm_alphas(t):
|
||||
return torch.matmul(alphas[..., None], t).reshape(bs, n, 12)
|
||||
@@ -82,9 +86,6 @@ def _build_M(y, alphas, weight):
|
||||
dim=-1,
|
||||
).reshape(bs, -1, 12)
|
||||
|
||||
if weight is not None:
|
||||
M = M * weight.repeat(1, 2)[:, :, None]
|
||||
|
||||
return M
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user