Skip to content

Commit

Permalink
Fix large dataset (> 512 images) training in viewer_beta (#2669)
Browse files Browse the repository at this point in the history
* Fix large dataset (> 512 images) training in viewer_beta (#2586)

* fix index bug in update_camera_poses of viewer

* Set Ruff line lenth

---------

Co-authored-by: Gina Wu <[email protected]>
  • Loading branch information
brentyi and ginazhouhuiwu authored Dec 12, 2023
1 parent 281f81f commit 01d57b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nerfstudio/viewer_beta/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,15 @@ def update_camera_poses(self):
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."""
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ pythonVersion = "3.8"
pythonPlatform = "Linux"

[tool.ruff]
line-length = 120
select = [
"E", # pycodestyle errors.
"F", # Pyflakes rules.
Expand Down

0 comments on commit 01d57b9

Please sign in to comment.