mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-10 18:17:31 +08:00
* Increase max_res of first proposal network * fix render statemachine logic for viewer beta * clicking on cameras in the viewer * fix fov calculation, update camera positions while training * cleanup * backup * fix configure theme * Fix theme configure for latest dev version of viser * Fix runtime errors * add set up direction button * add pause resume button * Export panel * Render tab skeleton * make responsiveness more snappy by stopping training * depth composite * start implementing viewercontrol in new viewer * refactor background img to use depth and add depth layering option * show/hide images * speed up rendering * fix crop color background * crop * rotated crops * rotated crops * transform handle on crop box * fix xyzw for crop * oriented crop export for pointclouds, not for meshes yet * Initial render panel * Fix export button * Theme tweaks * fix background issue in cropping * export rotated poisson meshe * double normals definition in export panel * Visual nits * remove tsdf from export panel * Add licenses * Fix some CI errors * Type fixes * Fix tests * Fix numpy broken * various bugfix --------- Co-authored-by: Brent Yi <yibrenth@gmail.com> Co-authored-by: terrancewang <terrance.3512@gmail.com>
62 lines
1.7 KiB
Python
62 lines
1.7 KiB
Python
"""
|
|
Test colormaps
|
|
"""
|
|
import torch
|
|
|
|
from nerfstudio.utils import colormaps, plotly_utils
|
|
|
|
|
|
def test_apply_colormap():
|
|
"""Test adding a colormap to data"""
|
|
data = torch.rand((10, 20, 1))
|
|
colored_data = colormaps.apply_colormap(data)
|
|
|
|
assert colored_data.shape == (10, 20, 3)
|
|
assert torch.min(colored_data) >= 0
|
|
assert torch.max(colored_data) <= 1
|
|
|
|
|
|
def test_apply_depth_colormap():
|
|
"""Test adding a colormap to depth data"""
|
|
data = torch.rand((10, 20, 1))
|
|
accum = torch.rand((10, 20, 1))
|
|
accum = accum / torch.max(accum)
|
|
colored_data = colormaps.apply_depth_colormap(depth=data, accumulation=accum)
|
|
|
|
assert colored_data.shape == (10, 20, 3)
|
|
assert torch.min(colored_data) >= 0
|
|
assert torch.max(colored_data) <= 1
|
|
|
|
|
|
def test_apply_boolean_colormap():
|
|
"""Test adding a colormap to boolean data"""
|
|
data = torch.rand((10, 20, 1))
|
|
data = data > 0.5
|
|
colored_data = colormaps.apply_boolean_colormap(data)
|
|
|
|
assert colored_data.shape == (10, 20, 3)
|
|
assert torch.min(colored_data) >= 0
|
|
assert torch.max(colored_data) <= 1
|
|
|
|
|
|
def test_cube_center():
|
|
"""Test adding a cube"""
|
|
cube = plotly_utils.get_cube(1.0, torch.Tensor([2.0, 3.0, 4.0]))
|
|
assert cube.x is not None
|
|
assert cube.y is not None
|
|
assert cube.z is not None
|
|
assert cube.x[0] == 1.5
|
|
assert cube.y[0] == 2.5
|
|
assert cube.z[-1] == 4.5
|
|
|
|
|
|
def test_aabb_center():
|
|
"""Test adding a cube with different dsid length"""
|
|
cube = plotly_utils.get_cube(torch.Tensor([2.0, 1.0, 3.0]))
|
|
assert cube.x is not None
|
|
assert cube.y is not None
|
|
assert cube.z is not None
|
|
assert cube.x[0] == -1
|
|
assert cube.y[0] == -0.5
|
|
assert cube.z[-1] == 1.5
|