mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 15:59:16 +08:00
Default fied_heads with instances will cause shared parameters (#2197)
* - Bug report. Modified the default parameters of NeRFField to avoid shared RGBFieldHead * - Modified to ensure minimal changes * - Modified type checking
This commit is contained in:
1 parent
904e1352d9
commit
e9a5a66a54
1 file changed
+3
-3
@@ -15,7 +15,7 @@
|
|||||||
"""Classic NeRF field"""
|
"""Classic NeRF field"""
|
||||||
|
|
||||||
|
|
||||||
from typing import Dict, Optional, Tuple
|
from typing import Dict, Optional, Tuple, Type
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch import Tensor, nn
|
from torch import Tensor, nn
|
||||||
@@ -57,7 +57,7 @@ class NeRFField(Field):
|
|||||||
head_mlp_num_layers: int = 2,
|
head_mlp_num_layers: int = 2,
|
||||||
head_mlp_layer_width: int = 128,
|
head_mlp_layer_width: int = 128,
|
||||||
skip_connections: Tuple[int] = (4,),
|
skip_connections: Tuple[int] = (4,),
|
||||||
field_heads: Optional[Tuple[FieldHead]] = (RGBFieldHead(),),
|
field_heads: Optional[Tuple[Type[FieldHead]]] = (RGBFieldHead,),
|
||||||
use_integrated_encoding: bool = False,
|
use_integrated_encoding: bool = False,
|
||||||
spatial_distortion: Optional[SpatialDistortion] = None,
|
spatial_distortion: Optional[SpatialDistortion] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -83,7 +83,7 @@ class NeRFField(Field):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.field_output_density = DensityFieldHead(in_dim=self.mlp_base.get_out_dim())
|
self.field_output_density = DensityFieldHead(in_dim=self.mlp_base.get_out_dim())
|
||||||
self.field_heads = nn.ModuleList(field_heads)
|
self.field_heads = nn.ModuleList([field_head() for field_head in field_heads] if field_heads else []) # type: ignore
|
||||||
for field_head in self.field_heads:
|
for field_head in self.field_heads:
|
||||||
field_head.set_in_dim(self.mlp_head.get_out_dim()) # type: ignore
|
field_head.set_in_dim(self.mlp_head.get_out_dim()) # type: ignore
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user