mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-26 10:59:53 +08:00
Cleanup mipnerf implementation
This commit is contained in:
1 parent
6deb452825
commit
cc79708df7
7 files changed
+377
-16
No files matched your search
@@ -41,6 +41,7 @@ class NeRFField(Field):
|
||||
head_mlp_layer_width: int = 128,
|
||||
skip_connections: Tuple[int] = (4,),
|
||||
field_heads: Tuple[FieldHead] = (RGBFieldHead(),),
|
||||
use_integrated_encoding: bool = False,
|
||||
) -> None:
|
||||
"""Create boilerplate NeRF field.
|
||||
|
||||
@@ -52,10 +53,12 @@ class NeRFField(Field):
|
||||
head_mlp_num_layers (int, optional): Number of layer for ourput head MLP. Defaults to 2.
|
||||
head_mlp_layer_width (int, optional): Width of output head MLP layers. Defaults to 128.
|
||||
skip_connections (Tuple, optional): Where to add skip connection in base MLP. Defaults to (4,).
|
||||
use_integrated_encoding (bool, optional): Used integrated samples as encoding input, Defaults to False.
|
||||
"""
|
||||
super().__init__()
|
||||
self.position_encoding = position_encoding
|
||||
self.direction_encoding = direction_encoding
|
||||
self.use_integrated_encoding = use_integrated_encoding
|
||||
|
||||
self.mlp_base = MLP(
|
||||
in_dim=self.position_encoding.get_out_dim(),
|
||||
@@ -77,7 +80,11 @@ class NeRFField(Field):
|
||||
|
||||
def get_density(self, point_samples: PointSamples):
|
||||
"""Computes and returns the densities."""
|
||||
encoded_xyz = self.position_encoding(point_samples.frustums.get_positions())
|
||||
if self.use_integrated_encoding:
|
||||
gaussian_samples = point_samples.frustums.get_gaussian_blob()
|
||||
encoded_xyz = self.position_encoding(gaussian_samples.mean, covs=gaussian_samples.cov)
|
||||
else:
|
||||
encoded_xyz = self.position_encoding(point_samples.frustums.get_positions())
|
||||
base_mlp_out = self.mlp_base(encoded_xyz)
|
||||
density = self.field_output_density(base_mlp_out)
|
||||
return density, base_mlp_out
|
||||
|
||||
Reference in new issue
Block a user