Fix large dataset (> 512 images) training in viewer_beta (#2586)

* fix index bug in update_camera_poses of viewer
This commit is contained in:
Gina Wu authored and GitHub committed 2023-11-06 07:46:21 -08:00
1 parent 1a3ee1aa4f
commit 9e33b437df
1 file changed
+5 -5
+5 -5
View File
@@ -260,15 +260,15 @@ class Viewer:
with torch.no_grad():
assert isinstance(camera_optimizer, CameraOptimizer)
c2ws_delta = camera_optimizer(torch.tensor(idxs, device=camera_optimizer.device)).cpu().numpy()
for idx in idxs:
for i, key in enumerate(idxs):
# both are numpy arrays
c2w_orig = self.original_c2w[idx]
c2w_delta = c2ws_delta[idx, ...]
c2w_orig = self.original_c2w[key]
c2w_delta = c2ws_delta[i, ...]
c2w = c2w_orig @ np.concatenate((c2w_delta, np.array([[0, 0, 0, 1]])), axis=0)
R = vtf.SO3.from_matrix(c2w[:3, :3]) # type: ignore
R = R @ vtf.SO3.from_x_radians(np.pi)
self.camera_handles[idx].position = c2w[:3, 3] * VISER_NERFSTUDIO_SCALE_RATIO
self.camera_handles[idx].wxyz = R.wxyz
self.camera_handles[key].position = c2w[:3, 3] * VISER_NERFSTUDIO_SCALE_RATIO
self.camera_handles[key].wxyz = R.wxyz
def _interrupt_render(self, _) -> None:
"""Interrupt current render."""