Skip to content

Commit 5a66d3c

Browse files
authored
Match gridbatch and grid API (#282)
Changed some things in grid, now changing them in gridbatch too. 1. Rigorous naming of coordinates spaces (world means world, voxel means ijk, index means linear offset). Updated methods to reflect this. 2. Moved load/save functions to from_nanovdb, save_nanovdb which conforms with `Grid` and `GaussianSplat3d` (`from_ply`/`save_ply`). 3. Renamed `read/write_to/from_dense_cmajor/minor` to `inject_to/from_dense_cmajor/minor` because these are just injection functions over dense grids and it conforms with `inject_from_ijk`. Signed-off-by: Francis Williams <francis@fwilliams.info>
1 parent bd15de3 commit 5a66d3c

File tree

11 files changed

+252
-256
lines changed

11 files changed

+252
-256
lines changed

examples/wip/structure_prediction_net.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@
44

55
import os
66

7+
import fvdb.nn as fvnn
78
import numpy as np
9+
import point_cloud_utils as pcu
10+
import polyscope as ps
811
import torch
912
import torch.nn as nn
1013
import torch.nn.functional as F
11-
12-
import point_cloud_utils as pcu
13-
import polyscope as ps
14-
1514
import torch_cudamanaged
1615

1716
import fvdb
18-
import fvdb.nn as fvnn
1917

2018
torch.backends.cudnn.deterministic = True
2119
np.random.seed(42)
@@ -125,7 +123,7 @@ def normalize_pts(xyz: np.ndarray):
125123

126124
def visualize_grid(grid: fvdb.GridBatch):
127125
ps.init()
128-
xyz = grid.grid_to_world(grid.ijk.float())
126+
xyz = grid.voxel_to_world(grid.ijk.float())
129127
for batch_idx in range(grid.grid_count):
130128
pts = xyz[batch_idx].jdata.cpu().numpy()
131129
ps.register_point_cloud(f"grid_{batch_idx}", pts, radius=0.0025)

fvdb/__init__.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,8 @@ def _parse_device_string(device_or_device_string: str | torch.device) -> torch.d
7575
jempty,
7676
)
7777

78-
# Import GridBatch and gridbatch_from_* functions from grid_batch.py
79-
from .grid_batch import (
80-
GridBatch,
81-
load_gridbatch,
82-
save_gridbatch,
83-
)
84-
85-
78+
# Import GridBatch and Grid
79+
from .grid_batch import GridBatch
8680
from .grid import Grid
8781

8882

0 commit comments

Comments
 (0)