diff --git a/nerfstudio/model_components/ray_samplers.py b/nerfstudio/model_components/ray_samplers.py index 2705b516c..1f3dac2ea 100644 --- a/nerfstudio/model_components/ray_samplers.py +++ b/nerfstudio/model_components/ray_samplers.py @@ -467,6 +467,7 @@ class VolumetricSampler(Sampler): far_plane=far_plane, stratified=self.training, cone_angle=cone_angle, + alpha_thre=1e-2, ) num_samples = starts.shape[0] @@ -477,7 +478,7 @@ class VolumetricSampler(Sampler): starts = torch.ones((1, 1), dtype=starts.dtype, device=rays_o.device) ends = torch.ones((1, 1), dtype=ends.dtype, device=rays_o.device) - ray_indices = nerfacc.unpack_to_ray_indices(packed_info).long() + ray_indices = nerfacc.unpack_info(packed_info) origins = rays_o[ray_indices] dirs = rays_d[ray_indices] if camera_indices is not None: diff --git a/nerfstudio/model_components/renderers.py b/nerfstudio/model_components/renderers.py index 1ebb61015..64b8bced3 100644 --- a/nerfstudio/model_components/renderers.py +++ b/nerfstudio/model_components/renderers.py @@ -236,7 +236,7 @@ class DepthRenderer(nn.Module): else: depth = torch.sum(weights * steps, dim=-2) / (torch.sum(weights, -2) + eps) - depth = torch.clip(depth, steps[..., 0, :], steps[..., -1, :]) + depth = torch.clip(depth, steps.min(), steps.max()) return depth diff --git a/nerfstudio/models/instant_ngp.py b/nerfstudio/models/instant_ngp.py index 7df255921..480c52ee8 100644 --- a/nerfstudio/models/instant_ngp.py +++ b/nerfstudio/models/instant_ngp.py @@ -139,6 +139,8 @@ class NGPModel(Model): self, training_callback_attributes: TrainingCallbackAttributes ) -> List[TrainingCallback]: def update_occupancy_grid(step: int): + # TODO: needs to get access to the sampler, on how the step size is determinated at each x. See + # https://github.com/KAIR-BAIR/nerfacc/blob/127223b11401125a9fce5ce269bb0546ee4de6e8/examples/train_ngp_nerf.py#L190-L213 self.occupancy_grid.every_n_step( step=step, occ_eval_fn=lambda x: self.field.get_opacity(x, self.config.render_step_size), diff --git a/pyproject.toml b/pyproject.toml index 651502a87..e80a7d023 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ dependencies = [ "mediapy==1.1.0", "msgpack==1.0.4", "msgpack_numpy==0.4.8", - "nerfacc==0.1.3", + "nerfacc==0.2.0", "opencv-python==4.6.0.66", "plotly==5.7.0", "protobuf==3.20.0",