Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AABB Conflict FIx #3422

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nerfstudio/models/instant_ngp.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def populate_modules(self):
self.config.render_step_size = ((self.scene_aabb[3:] - self.scene_aabb[:3]) ** 2).sum().sqrt().item() / 1000
# Occupancy Grid.
self.occupancy_grid = nerfacc.OccGridEstimator(
roi_aabb=self.scene_aabb,
Copy link
Contributor

@hoanhle hoanhle Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that this would uniformly shrink or grow the scene_aabb from the origin, without considering the center.

A correct approach would be to first implement something like this in SceneBox

    def get_scaled_scene_box(self, scale_factor: Union[float, torch.Tensor] = 1.5):
        """Returns a new box that has been scaled by the given factor while
        maintaining its center.

        Args:
            scale_factor: How much to scale the bounding box by.

        Returns:
            SceneBox: A new SceneBox with the scaled bounding box.
        """
        center = self.get_center()
        scaled_aabb = (self.aabb - center) * scale_factor + center
        return SceneBox(aabb=scaled_aabb)

and then , call this function where needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if you could include this. I can review the PR once it's up. Also, I think it would be a good idea to disable scene contraction by default in instant-ngp.

roi_aabb=self.scene_aabb * 2 ** -(self.config.grid_levels - 1),
resolution=self.config.grid_resolution,
levels=self.config.grid_levels,
)
Expand Down
Loading