bugfix in cotcurv laplacian loss. closes #551 (#553)

Summary: Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/553

Reviewed By: theschnitz

Differential Revision: D26257591

Pulled By: gkioxari

fbshipit-source-id: 899a3f733a77361e8572b0900a34b55764ff08f2
This commit is contained in:
Shubham Goel
2021-02-10 21:21:54 -08:00
committed by Facebook GitHub Bot
parent 17468e2862
commit e13e63a811
2 changed files with 6 additions and 4 deletions

View File

@@ -89,11 +89,12 @@ class TestLaplacianSmoothing(unittest.TestCase):
inv_areas[idx] = 1.0 / inv_areas[idx]
norm_w = L.sum(dim=1, keepdims=True)
L_sum = norm_w.clone()
idx = norm_w > 0
norm_w[idx] = 1.0 / norm_w[idx]
if method == "cotcurv":
loss = (L.mm(verts_packed) - verts_packed) * inv_areas * 0.25
loss = (L.mm(verts_packed) - L_sum * verts_packed) * inv_areas * 0.25
loss = loss.norm(dim=1)
else:
loss = L.mm(verts_packed) * norm_w - verts_packed
@@ -147,7 +148,7 @@ class TestLaplacianSmoothing(unittest.TestCase):
def test_laplacian_smoothing_cot(self):
"""
Test Laplacian Smoothing with uniform weights.
Test Laplacian Smoothing with cot weights.
"""
meshes = TestLaplacianSmoothing.init_meshes(10, 100, 300)
@@ -161,7 +162,7 @@ class TestLaplacianSmoothing(unittest.TestCase):
def test_laplacian_smoothing_cotcurv(self):
"""
Test Laplacian Smoothing with uniform weights.
Test Laplacian Smoothing with cotcurv weights.
"""
meshes = TestLaplacianSmoothing.init_meshes(10, 100, 300)