Skip to content

Commit

Permalink
Make nuScenes dataparser compatible with ParallelDataManager
Browse files Browse the repository at this point in the history
The ParallelDataManager (see nerfstudio-project#2092) makes pytorch crash if the cameras instance's fx, fy, cx or cy tensors
are loaded from a common shared tensor.

This PR fixes the issue by cloning the respective tensors before passing them to the Cameras(...) constructor.
  • Loading branch information
dmholtz committed Nov 30, 2023
1 parent 5a772b1 commit f926c99
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nerfstudio/data/dataparsers/nuscenes_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ def _generate_dataparser_outputs(self, split="train"):
)

cameras = Cameras(
fx=intrinsics[:, 0, 0],
fy=intrinsics[:, 1, 1],
cx=intrinsics[:, 0, 2],
cy=intrinsics[:, 1, 2],
fx=intrinsics[:, 0, 0].detach().clone(),
fy=intrinsics[:, 1, 1].detach().clone(),
cx=intrinsics[:, 0, 2].detach().clone(),
cy=intrinsics[:, 1, 2].detach().clone(),
height=900,
width=1600,
camera_to_worlds=poses[:, :3, :4],
Expand Down

0 comments on commit f926c99

Please sign in to comment.