fix SH bug with non-unitary relative_scale

This commit is contained in:
harry7557558
2025-06-22 18:29:59 -04:00
parent 06f0635878
commit b07dfa3381
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -764,7 +764,7 @@ class SpirulaeModel(Model):
timerr.mark("map") # 300us-450us
if self.config.sh_degree > 0:
viewdirs = self.means.detach() - optimized_camera_to_world[:3, 3].to(device) # (N, 3)
viewdirs = self.means.detach() - T.squeeze(-1).to(device) # (N, 3)
n = min(self.step // self.config.sh_degree_interval, self.config.sh_degree)
rgbs = spherical_harmonics(n, viewdirs, self.features_dc, self.features_sh) # input unnormalized viewdirs
rgbs = rgbs + 0.5
+1 -1
View File
@@ -31,7 +31,7 @@ def _test_sh(method):
optim.zero_grad()
# compute PyTorch's color and grad
check_colors = _torch_impl.compute_sh_color(viewdirs, sh_coeffs, method)
check_colors = _torch_impl.compute_sh_color(viewdirs, sh_coeffs, "poly")
check_loss = torch.square(check_colors - gt_colors).mean()
check_loss.backward()
check_grad = sh_coeffs.grad.detach()