mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 13:59:10 +08:00
dataloader logic, new folder structure, flatter configs (#26)
* renaming dataloader to data. adding some dataloader classes * restructuring configs * fixed instant ngp tcnn direction rescaling * working through test cases * black and lint and tests
This commit is contained in:
1 parent
24c1c77ef1
commit
457788d689
105 files changed
+8828
-682
No files matched your search
@@ -4,14 +4,14 @@ Test the camera classes.
|
||||
|
||||
import torch
|
||||
|
||||
from pyrad.structures.cameras import EquirectangularCamera, PinholeCamera
|
||||
from pyrad.structures.rays import RayBundle
|
||||
from pyrad.cameras.cameras import EquirectangularCamera, PinholeCamera
|
||||
from pyrad.cameras.rays import RayBundle
|
||||
|
||||
|
||||
def test_pinhole_camera():
|
||||
"""Test that the pinhole camera model works."""
|
||||
pinhole_camera = PinholeCamera(cx=400.0, cy=400.0, fx=10.0, fy=10.0)
|
||||
camera_ray_bundle = pinhole_camera.generate_camera_rays()
|
||||
camera_ray_bundle = pinhole_camera.get_camera_ray_bundle()
|
||||
assert isinstance(camera_ray_bundle, RayBundle)
|
||||
assert torch.allclose(camera_ray_bundle.origins[0], torch.tensor([0.0, 0.0, 0.0]))
|
||||
|
||||
@@ -26,7 +26,7 @@ def test_pinhole_camera():
|
||||
def test_equirectangular_camera():
|
||||
"""Test that the equirectangular camera model works."""
|
||||
equirectangular_camera = EquirectangularCamera(height=400, width=400)
|
||||
camera_ray_bundle = equirectangular_camera.generate_camera_rays()
|
||||
camera_ray_bundle = equirectangular_camera.get_camera_ray_bundle()
|
||||
assert isinstance(camera_ray_bundle, RayBundle)
|
||||
assert torch.allclose(camera_ray_bundle.origins[0], torch.tensor([0.0, 0.0, 0.0]))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Embedding tests
|
||||
"""
|
||||
from pyrad.nerf.field_modules.embedding import Embedding
|
||||
from pyrad.fields.modules.embedding import Embedding
|
||||
|
||||
|
||||
def test_indexing():
|
||||
@@ -3,7 +3,7 @@ Encoding Tests
|
||||
"""
|
||||
import pytest
|
||||
import torch
|
||||
from pyrad.nerf.field_modules import encoding
|
||||
from pyrad.fields.modules import encoding
|
||||
|
||||
|
||||
def test_scaling_and_offset():
|
||||
+1
-1
@@ -5,7 +5,7 @@ import torch
|
||||
from torch import nn
|
||||
import pytest
|
||||
|
||||
from pyrad.nerf.field_modules.field_heads import (
|
||||
from pyrad.fields.modules.field_heads import (
|
||||
DensityFieldHead,
|
||||
FieldHead,
|
||||
FieldHeadNames,
|
||||
@@ -4,7 +4,7 @@ MLP Test
|
||||
import torch
|
||||
from torch import nn
|
||||
|
||||
from pyrad.nerf.field_modules import MLP
|
||||
from pyrad.fields.modules import MLP
|
||||
|
||||
|
||||
def test_mlp():
|
||||
@@ -3,9 +3,9 @@ Test the fields
|
||||
"""
|
||||
import torch
|
||||
|
||||
from pyrad.nerf.field_modules.field_heads import FieldHeadNames
|
||||
from pyrad.nerf.fields.instant_ngp_field import TCNNInstantNGPField
|
||||
from pyrad.structures.rays import Frustums, PointSamples
|
||||
from pyrad.fields.modules.field_heads import FieldHeadNames
|
||||
from pyrad.fields.instant_ngp_field import TCNNInstantNGPField
|
||||
from pyrad.cameras.rays import Frustums, PointSamples
|
||||
|
||||
|
||||
def test_tcnn_instant_ngp_field():
|
||||
@@ -31,9 +31,9 @@ def test_tcnn_instant_ngp_field():
|
||||
frustums = Frustums(
|
||||
origins=positions,
|
||||
directions=directions,
|
||||
frustum_starts=torch.zeros((*directions.shape[:-1], 1)),
|
||||
frustum_ends=torch.zeros((*directions.shape[:-1], 1)),
|
||||
pixel_area=torch.ones((*directions.shape[:-1], 1)),
|
||||
frustum_starts=torch.zeros((*directions.shape[:-1], 1), device=device),
|
||||
frustum_ends=torch.zeros((*directions.shape[:-1], 1), device=device),
|
||||
pixel_area=torch.ones((*directions.shape[:-1], 1), device=device),
|
||||
)
|
||||
point_samples = PointSamples(frustums=frustums)
|
||||
field_outputs = field.forward(point_samples)
|
||||
@@ -3,7 +3,7 @@ Code to test the occupancy grid.
|
||||
"""
|
||||
|
||||
import torch
|
||||
from pyrad.nerf.occupancy_grid import OccupancyGrid
|
||||
from pyrad.fields.occupancy_fields.occupancy_grid import OccupancyGrid
|
||||
|
||||
|
||||
def test_occupancy_grid():
|
||||
@@ -2,10 +2,10 @@
|
||||
Test samplers
|
||||
"""
|
||||
import torch
|
||||
from pyrad.nerf.ray_sampler import PDFSampler, UniformSampler
|
||||
from pyrad.graphs.modules.ray_sampler import PDFSampler, UniformSampler
|
||||
|
||||
from pyrad.structures.rays import RayBundle
|
||||
from pyrad.nerf.colliders import NearFarCollider
|
||||
from pyrad.cameras.rays import RayBundle
|
||||
from pyrad.graphs.modules.scene_colliders import NearFarCollider
|
||||
|
||||
|
||||
def test_uniform_sampler():
|
||||
@@ -4,7 +4,7 @@ Test renderers
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from pyrad.nerf import renderers
|
||||
from pyrad.renderers import renderers
|
||||
|
||||
|
||||
def test_rgb_renderer():
|
||||
Reference in new issue
Block a user