Occupancy grid (#79)

* occupancy grid in progress

* visualizing occupancy grid. currently restructing field and renderer head outputs

* black and pylint. broke nerfw and semantic nerf but it's okay

* get_project_root
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-05-17 19:09:25 -07:00
1 parent 5c2d8c2a0b
commit fb440fedf3
23 files changed
+423 -217

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
"""
Code to test the occupancy grid.
"""
import torch
from mattport.nerf.occupancy_grid import OccupancyGrid
def test_occupancy_grid():
"""For testing the occupancy grid."""
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
num_cascades = 1
resolution = 128
aabb = torch.tensor([[-1, -1, -1], [1, 1, 1]], dtype=torch.float32).to(device)
grid = OccupancyGrid(num_cascades, resolution, aabb)
grid.to(device)
density_fn = lambda x: x[..., 0:1] # xyz (..., 3) => density (...,)
grid.update_occupancy_grid(density_fn=density_fn)
if __name__ == "__main__":
test_occupancy_grid()