mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-04 06:49:13 +08:00
Rename scene bounds (#605)
This commit is contained in:
1 parent
bc2aa64aba
commit
4110bd7a3e
25 files changed
+98
-102
No files matched your search
@@ -30,7 +30,7 @@ from torch.nn import Parameter
|
||||
from nerfstudio.cameras.rays import RayBundle
|
||||
from nerfstudio.configs.base_config import InstantiateConfig
|
||||
from nerfstudio.configs.config_utils import to_immutable_dict
|
||||
from nerfstudio.data.scene_box import SceneBounds
|
||||
from nerfstudio.data.scene_box import SceneBox
|
||||
from nerfstudio.model_components.scene_colliders import NearFarCollider
|
||||
from nerfstudio.utils.callbacks import TrainingCallback, TrainingCallbackAttributes
|
||||
|
||||
@@ -59,7 +59,7 @@ class Model(nn.Module):
|
||||
|
||||
Args:
|
||||
config: configuration for instantiating model
|
||||
scene_bounds: dataset scene bounds
|
||||
scene_box: dataset scene box
|
||||
"""
|
||||
|
||||
config: ModelConfig
|
||||
@@ -67,13 +67,13 @@ class Model(nn.Module):
|
||||
def __init__(
|
||||
self,
|
||||
config: ModelConfig,
|
||||
scene_bounds: SceneBounds,
|
||||
scene_box: SceneBox,
|
||||
num_train_data: int,
|
||||
**kwargs,
|
||||
) -> None:
|
||||
super().__init__()
|
||||
self.config = config
|
||||
self.scene_bounds = scene_bounds
|
||||
self.scene_box = scene_box
|
||||
self.num_train_data = num_train_data
|
||||
self.kwargs = kwargs
|
||||
self.collider = None
|
||||
|
||||
@@ -98,13 +98,13 @@ class NGPModel(Model):
|
||||
super().populate_modules()
|
||||
|
||||
self.field = TCNNInstantNGPField(
|
||||
aabb=self.scene_bounds.aabb,
|
||||
aabb=self.scene_box.aabb,
|
||||
contraction_type=self.config.contraction_type,
|
||||
use_appearance_embedding=self.config.use_appearance_embedding,
|
||||
num_images=self.num_train_data,
|
||||
)
|
||||
|
||||
self.scene_aabb = Parameter(self.scene_bounds.aabb.flatten(), requires_grad=False)
|
||||
self.scene_aabb = Parameter(self.scene_box.aabb.flatten(), requires_grad=False)
|
||||
|
||||
# Occupancy Grid
|
||||
self.occupancy_grid = nerfacc.OccupancyGrid(
|
||||
@@ -114,7 +114,7 @@ class NGPModel(Model):
|
||||
)
|
||||
|
||||
# Sampler
|
||||
vol_sampler_aabb = self.scene_bounds.aabb if self.config.contraction_type == ContractionType.AABB else None
|
||||
vol_sampler_aabb = self.scene_box.aabb if self.config.contraction_type == ContractionType.AABB else None
|
||||
self.sampler = VolumetricSampler(
|
||||
scene_aabb=vol_sampler_aabb,
|
||||
occupancy_grid=self.occupancy_grid,
|
||||
|
||||
@@ -105,7 +105,7 @@ class NerfactoModel(Model):
|
||||
# Fields
|
||||
if self.config.use_appearance_conditioning:
|
||||
self.field = TCNNNerfactoField(
|
||||
self.scene_bounds.aabb,
|
||||
self.scene_box.aabb,
|
||||
spatial_distortion=scene_contraction,
|
||||
num_images=self.num_train_data,
|
||||
use_average_appearance_embedding=self.config.use_average_appearance_embedding,
|
||||
@@ -116,12 +116,12 @@ class NerfactoModel(Model):
|
||||
# Build the proposal network(s)
|
||||
self.proposal_networks = torch.nn.ModuleList()
|
||||
if self.config.use_same_proposal_network:
|
||||
network = HashMLPDensityField(self.scene_bounds.aabb, spatial_distortion=scene_contraction)
|
||||
network = HashMLPDensityField(self.scene_box.aabb, spatial_distortion=scene_contraction)
|
||||
self.proposal_networks.append(network)
|
||||
self.density_fns = [network.density_fn for _ in range(self.config.num_proposal_network_iterations)]
|
||||
else:
|
||||
for _ in range(self.config.num_proposal_network_iterations):
|
||||
network = HashMLPDensityField(self.scene_bounds.aabb, spatial_distortion=scene_contraction)
|
||||
network = HashMLPDensityField(self.scene_box.aabb, spatial_distortion=scene_contraction)
|
||||
self.proposal_networks.append(network)
|
||||
self.density_fns = [network.density_fn for network in self.proposal_networks]
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ class NerfWModel(Model):
|
||||
|
||||
# colliders
|
||||
if self.config.enable_collider:
|
||||
self.collider = AABBBoxCollider(scene_bounds=self.scene_bounds)
|
||||
self.collider = AABBBoxCollider(scene_box=self.scene_box)
|
||||
|
||||
def get_param_groups(self):
|
||||
param_groups = {}
|
||||
|
||||
@@ -74,7 +74,7 @@ class SemanticNerfModel(NeRFModel):
|
||||
|
||||
# colliders
|
||||
if self.config.enable_collider:
|
||||
self.collider = AABBBoxCollider(scene_bounds=self.scene_bounds)
|
||||
self.collider = AABBBoxCollider(scene_box=self.scene_box)
|
||||
|
||||
def get_outputs(self, ray_bundle: RayBundle):
|
||||
# uniform sampling
|
||||
|
||||
Reference in new issue
Block a user