mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-24 08:35:41 +08:00
Switch to dictionary outputs
This commit is contained in:
1 parent
af74b4e95c
commit
05f2537605
6 files changed
+39
-33
No files matched your search
@@ -4,17 +4,16 @@ Field output tests
|
||||
import torch
|
||||
from torch import nn
|
||||
|
||||
from mattport.nerf.field_modules import field_heads
|
||||
from mattport.nerf.field_modules.field_heads import DensityFieldHead, FieldHead, FieldHeadNames, RGBFieldHead
|
||||
|
||||
|
||||
def test_field_output():
|
||||
"""Test render output"""
|
||||
in_dim = 6
|
||||
out_dim = 4
|
||||
field_head_name = FieldHeadNames.DENSITY
|
||||
activation = nn.ReLU()
|
||||
render_head = field_heads.FieldHead(
|
||||
in_dim=in_dim, out_dim=out_dim, field_quantity_name="rgb", activation=activation
|
||||
)
|
||||
render_head = FieldHead(in_dim=in_dim, out_dim=out_dim, field_head_name=field_head_name, activation=activation)
|
||||
assert render_head.get_out_dim() == out_dim
|
||||
|
||||
x = torch.ones((9, in_dim))
|
||||
@@ -24,7 +23,7 @@ def test_field_output():
|
||||
def test_density_output():
|
||||
"""Test rgb output"""
|
||||
in_dim = 6
|
||||
density_head = field_heads.DensityFieldHead(in_dim)
|
||||
density_head = DensityFieldHead(in_dim)
|
||||
assert density_head.get_out_dim() == 1
|
||||
|
||||
x = torch.ones((9, in_dim))
|
||||
@@ -34,8 +33,14 @@ def test_density_output():
|
||||
def test_rgb_output():
|
||||
"""Test rgb output"""
|
||||
in_dim = 6
|
||||
rgb_head = field_heads.RGBFieldHead(in_dim)
|
||||
rgb_head = RGBFieldHead(in_dim)
|
||||
assert rgb_head.get_out_dim() == 3
|
||||
|
||||
x = torch.ones((9, in_dim))
|
||||
rgb_head(x)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_field_output()
|
||||
test_density_output()
|
||||
test_rgb_output()
|
||||
Reference in new issue
Block a user