mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-27 11:30:11 +08:00
Add temporal distortion and D-NeRF model (#825)
* Add D-NeRF temporal distortion and D-NeRF model This allows for temporal distortion to be enabled on a variety of models through config parameters, without an explicit model. Temporal distortion and MIP-NeRF are not currently jointly runnable but can be changed in the future. * Simplifying changes * Simplifying changes Co-authored-by: Matthew Tancik <tancik@berkeley.edu>
This commit is contained in:
1 parent
8678f4c2e6
commit
9ff167d705
9 files changed
+206
-7
No files matched your search
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
Test if temporal distortions run properly
|
||||
"""
|
||||
import torch
|
||||
|
||||
from nerfstudio.field_components.temporal_distortions import DNeRFDistortion
|
||||
|
||||
|
||||
def test_dnerf_distortion():
|
||||
"""Test dnerf distortion"""
|
||||
# pylint: disable=import-outside-toplevel
|
||||
# pylint: disable=unused-import
|
||||
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
||||
distortion = DNeRFDistortion().to(device)
|
||||
|
||||
num_rays = 1024
|
||||
num_samples = 256
|
||||
positions = torch.rand((num_rays, num_samples, 3), dtype=torch.float32, device=device)
|
||||
assert distortion.forward(positions, None) is None
|
||||
times = torch.rand_like(positions[..., :1])
|
||||
assert distortion.forward(positions, times).shape == positions.shape
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_dnerf_distortion()
|
||||
Reference in new issue
Block a user