MCPcopy Create free account
hub / github.com/Sin3DM/Sin3DM / load_sdfgrid2vox

Function load_sdfgrid2vox

evaluation/patch_utils.py:8–18  ·  view source on GitHub ↗
(path, binarize=True, resolution=128, device="cpu")

Source from the content-addressed store, hash-verified

6
7
8def load_sdfgrid2vox(path, binarize=True, resolution=128, device="cpu"):
9 sdfgrid = np.load(path)["sdf_grid"][:]
10 sdfgrid = torch.from_numpy(sdfgrid).float().to(device)
11
12 if max(sdfgrid.shape) != resolution:
13 new_shape = [int(x * resolution / max(sdfgrid.shape)) for x in sdfgrid.shape]
14 sdfgrid = -F.adaptive_max_pool3d(-sdfgrid[None, None], new_shape)[0, 0]
15
16 if binarize:
17 sdfgrid = sdfgrid <= 0
18 return sdfgrid
19
20
21def load_voxgrid(path, resolution=128, device="cpu"):

Callers 2

eval_SSFID_given_pathsFunction · 0.90
eval_LP_given_pathsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected